callstack / callstack/react-native-paper
Snackbar as a function.
- Ngôn ngữ chính
- TypeScript
- Star
- 14.5k
- Fork
- 2.2k
- Merge trung bình
- 5 ngày 23 giờ
- Pull request đã merge (30 ngày)
- 12
Mô tả
It would be great if we could use Snackbar and toggle it as a function.
Like in [Toast](https://docs.nativebase.io/toast) provided by [Native Base](https://nativebase.io/), we can customize it like this
```javascript
import { Toast } from "native-base";
function show({
text,
type = "danger",
buttonText,
duration = 3000,
position,
bottom = 60,
}) {
Toast.show({
text: text,
position: position,
type: type,
duration: duration,
buttonText: buttonText,
});
}
export default {
show,
};
```
Then I use it on any screen or component like this
```javascript
Toast.show({ text: "This API call was successful" }); // This pops a Toast message and disappears after 3 seconds
```
I love the Snackbar that React Native Paper has, but I couldn't figure out how to use it as described above.
Right now, I have to add a component on every page and maintain a state to toggle it. It would have been so good if we could use it like `Snackbar.show("Some Text")`
If anyone has any advice on using Snackbar as a function to toggle Toasts, I would love to discuss it.
Versions :
- "react-native": "~0.63.4"
- "react-native-paper": "^4.9.2"
Hướng dẫn đóng góp
Hướng nghiên cứu
Bắt đầu bằng việc xem xét component/API Snackbar hiện có và ví dụ NativeBase Toast được liên kết trong issue. Xác định các tùy chọn gọi hàm được hỗ trợ và hành vi loại bỏ, sau đó xác minh API được đề xuất từ một màn hình hoặc component mà không duy trì trạng thái Snackbar riêng cho từng màn hình. Hoàn tất khi cách sử dụng dựa trên hàm được yêu cầu được hỗ trợ và ghi lại trong tài liệu.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Đánh giá
- Công nghệ
- react-native, typescript
- Lĩnh vực
- mobile
- Loại issue
- Tính năng
- Độ khó
- 5/5
- Thời gian dự kiến
- Hơn một tuần
- Mức độ hoạt động
- Đình trệ
- Độ rõ ràng
- Khá rõ ràng
- Mức phù hợp với người mới
- 35/100