Skip to content

Commit

Permalink
[toast] Implement toast component (#11)
Browse files Browse the repository at this point in the history
  • Loading branch information
InayaY3 authored Oct 3, 2023
1 parent 44a50ac commit 82a0973
Show file tree
Hide file tree
Showing 3 changed files with 56 additions and 4 deletions.
30 changes: 30 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@
"expo-status-bar": "~1.6.0",
"react": "18.2.0",
"react-native": "0.72.4",
"react-native-root-siblings": "^4.1.1",
"react-native-root-toast": "^3.5.1",
"react-native-ionicons": "^4.6.5",
"react-native-safe-area-context": "4.6.3",
"react-native-screens": "~3.22.0",
Expand Down
28 changes: 24 additions & 4 deletions src/screens/ToastScreen.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,30 @@
import React from 'react';
import { Text, View } from 'react-native';
import { Button, Text, View } from 'react-native';
import { RootSiblingParent } from 'react-native-root-siblings';
import Toast from 'react-native-root-toast';

const toast = () => {
Toast.show('Testing this out?', {
duration: Toast.durations.LONG,
position: Toast.positions.BOTTOM,
shadow: true,
animation: true,
hideOnPress: true,
delay: 0,
// onShow: () => {},
// onShown: () => {},
// onHide: () => {},
// onHidden: () => {}
});
};

export default function ToastScreen() {
return (
<View style={{ flex: 1, alignItems: 'center', justifyContent: 'center' }}>
<Text>Toast Page</Text>
</View>
<RootSiblingParent>
<View style={{ flex: 1, alignItems: 'center', justifyContent: 'center' }}>
<Text>Toast Page</Text>
<Button onPress={toast} title="Toast" />
</View>
</RootSiblingParent>
);
}

0 comments on commit 82a0973

Please sign in to comment.