Closed jmada closed 1 year ago
Same over here:
import { StatusBar } from "expo-status-bar";
import { SafeAreaProvider } from "react-native-safe-area-context";
import { RootSiblingParent } from "react-native-root-siblings";
// Screens
import { Home } from "./src/screens/Home/Home";
// Styles
import Toast from "react-native-toast-message";
export default function App() {
return (
<>
<SafeAreaProvider>
<RootSiblingParent>
<Toast />
<Home />
<StatusBar style="inverted" />
</RootSiblingParent>
</SafeAreaProvider>
</>
);
}
import { Toast } from "react-native-toast-message/lib/src/Toast";
export function Home() {
function handleCreate(task: string): void {
if (tasks.find((el) => el.description === task)) {
// FIXME: Toast not displaying
Toast.show({
type: "error",
text1: "Opa!",
text2: "Você já cadastrou uma tarefa igual a essa",
});
return;
}
setTasks((prev) => [...prev, { description: task, status: "unchecked" }]);
}
{...}
}
@jmada @Alan-Graton try adding <Toast />
in the bottom of StackNavigation
export default function App() {
return (
<>
<SafeAreaProvider>
<RootSiblingParent>
<Home />
<StatusBar style="inverted" />
<Toast /> // in the bottom of other components
</RootSiblingParent>
</SafeAreaProvider>
</>
);
}
@jmada @Alan-Graton try adding
<Toast />
in the bottom ofStackNavigation
export default function App() { return ( <> <SafeAreaProvider> <RootSiblingParent> <Home /> <StatusBar style="inverted" /> <Toast /> // in the bottom of other components </RootSiblingParent> </SafeAreaProvider> </> ); }
@KaviduAloka Thanks for the tip, will give a try
I faced the same problem, any updates for this issue ?
return (
<>
<ContextProvider>
<Navigation />
<Button title="Sign out" onPress={signOut} />
</ContextProvider>
<Toast />
</>
);
I've added
@jmada @Alan-Graton try adding
<Toast />
in the bottom ofStackNavigation
export default function App() { return ( <> <SafeAreaProvider> <RootSiblingParent> <Home /> <StatusBar style="inverted" /> <Toast /> // in the bottom of other components </RootSiblingParent> </SafeAreaProvider> </> ); }
Works For Me
@jmada @Alan-Graton try adding
<Toast />
in the bottom ofStackNavigation
export default function App() { return ( <> <SafeAreaProvider> <RootSiblingParent> <Home /> <StatusBar style="inverted" /> <Toast /> // in the bottom of other components </RootSiblingParent> </SafeAreaProvider> </> ); }
Worked for me! Thank you so much. I'm closing the issue. :)
Describe the bug The library isn't working on RN v0.72.4, it doesn't show the "toast" dialog.
Steps to reproduce Steps to reproduce the behavior: Just following the the quick start -> https://github.com/calintamas/react-native-toast-message/blob/main/docs/quick-start.md
Expected behavior It should show the toast dialog like the example.
Screenshots Nothing to add.
Code sample
Environment (please complete the following information):
Additional context Nothing to add.