How to use @react-navigation/native - 10 common examples

To help you get started, we’ve selected a few @react-navigation/native examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github berty / berty / js / packages / store / hooks.js View on Github external
export const useReadEffect = (publicKey, timeout) => {
	// timeout is the duration (in ms) that the user must stay on the page to set messages as read
	const navigation = useNavigation()

	const ctx = useMsgrContext()

	const fake = useConversation(publicKey)?.fake || false

	useEffect(() => {
		if (fake) {
			return
		}
		let timeoutID = null
		const handleStart = () => {
			if (timeoutID === null) {
				timeoutID = setTimeout(() => {
					timeoutID = null
					ctx.client.conversationOpen({ groupPk: publicKey }).catch((err) => {
						console.warn('failed to open conversation,', err)
github benevbright / react-navigation-collapsible / index.js View on Github external
const translateY = getTranslateY(animatedDiffClampY, headerHeight)

    return (
      
    )
  }
}

const CollapsibleHeaderBackView = withOrientation(_CollapsibleHeaderBackView);

const collapsibleNavigationOptions = (configOptions, userOptions, navigation) => {
  userOptions = {
    ...configOptions,
    ...userOptions,
    headerStyle:{
      ...configOptions.headerStyle,
      ...userOptions.headerStyle
    }
  };

  const navigationParams = navigation.state.params;

  if(!navigationParams || !navigationParams.animatedYSum ){
    // console.log('navigationParams is null');
    return userOptions;
github berty / berty / js / packages / store / hooks.ts View on Github external
export const useReadEffect = (publicKey: Maybe, timeout: Maybe) => {
	// timeout is the duration (in ms) that the user must stay on the page to set messages as read
	const navigation = useNavigation()

	const ctx = useMsgrContext()

	const conv = useConversation(publicKey)
	const fake = (conv && (conv as any).fake) || false

	useEffect(() => {
		if (fake) {
			return
		}
		let timeoutID: ReturnType | null = null
		const handleStart = () => {
			if (timeoutID === null) {
				let t = timeout
				if (typeof t !== 'number') {
					t = 1000
github berty / berty / js / packages / components / settings / Home.tsx View on Github external
export const Home: React.FC = () => {
	const account = useAccount()
	const [{ flex, background, row, margin }] = useStyles()
	const navigation = useNativeNavigation()

	return (
		<>
github react-navigation / experimental-transitioner / example / App.js View on Github external
);

const EXAMPLES = {
  Fade,
  Modal,
  Gesture,
  CardStack,
  SharedEl,
};

const AppNavigator = createSwitchNavigator({
  Examples,
  ...EXAMPLES,
});

const StatefulAppNavigator = createAppContainer(AppNavigator);

// const StatefulAppNavigator = createAppContainer(Fade);
// const StatefulAppNavigator = createAppContainer(Modal);
// const StatefulAppNavigator = createAppContainer(Gesture);
// const StatefulAppNavigator = createAppContainer(CardStack);
// const StatefulAppNavigator = createAppContainer(SharedEl);

const App = () => (
  
    
  
);

Expo.registerRootComponent(App);
github keybase / client / shared / router-v2 / router.native.tsx View on Github external
style={{backgroundColor: Styles.globalColors.white}}
  >
    
  
)

const RootStackNavigator = createSwitchNavigator(
  {
    loading: {screen: SimpleLoading},
    loggedIn: LoggedInStackNavigator,
    loggedOut: LoggedOutStackNavigator,
  },
  {initialRouteName: 'loading'}
)

const AppContainer = createAppContainer(RootStackNavigator)

class RNApp extends React.PureComponent {
  private nav: any = null

  // TODO remove this eventually, just so we can handle the old style actions
  dispatchOldAction = (old: any) => {
    const nav = this.nav
    if (!nav) {
      throw new Error('Missing nav?')
    }

    const actions = Shared.oldActionToNewActions(old, nav._navigation) || []
    try {
      actions.forEach(a => nav.dispatch(a))
    } catch (e) {
      logger.error('Nav error', e)
github keybase / client / shared / router-v2 / router.native.tsx View on Github external
style={{backgroundColor: Styles.globalColors.white}}
  >
    
  
)

const RootStackNavigator = createSwitchNavigator(
  {
    loading: {screen: SimpleLoading},
    loggedIn: LoggedInStackNavigator,
    loggedOut: LoggedOutStackNavigator,
  },
  {initialRouteName: 'loading'}
)

const AppContainer = createAppContainer(RootStackNavigator)

class RNApp extends React.PureComponent {
  private nav: any = null

  // TODO remove this eventually, just so we can handle the old style actions
  dispatchOldAction = (old: any) => {
    const nav = this.nav
    if (!nav) {
      throw new Error('Missing nav?')
    }

    const actions = Shared.oldActionToNewActions(old, nav._navigation) || []
    try {
      actions.forEach(a => nav.dispatch(a))
    } catch (e) {
      logger.error('Nav error', e)
github react-navigation / navigation-ex / example / src / Shared / Albums.tsx View on Github external
export default function Albums() {
  const ref = React.useRef(null);

  useScrollToTop(ref);

  return (
    
      {COVERS.map((source, i) => (
        // eslint-disable-next-line react/no-array-index-key
        <img style="{styles.cover}">
      ))}
      {COVERS.map((source, i) =&gt; (
        // eslint-disable-next-line react/no-array-index-key
        <img style="{styles.cover}">
      ))}
github react-navigation / navigation-ex / example / src / Shared / Chat.tsx View on Github external
export default function Chat() {
  const ref = React.useRef(null);

  useScrollToTop(ref);

  const { colors } = useTheme();

  return (
github react-navigation / navigation-ex / example / src / index.tsx View on Github external
export default function App() {
  const containerRef = React.useRef();

  // To test deep linking on, run the following in the Terminal:
  // Android: adb shell am start -a android.intent.action.VIEW -d "exp://127.0.0.1:19000/--/simple-stack"
  // iOS: xcrun simctl openurl booted exp://127.0.0.1:19000/--/simple-stack
  // The first segment of the link is the the scheme + host (returned by `Linking.makeUrl`)
  const { getInitialState } = useLinking(containerRef, {
    prefixes: LinkingPrefixes,
    config: {
      Root: Object.keys(SCREENS).reduce&lt;{ [key: string]: string }&gt;(
        (acc, name) =&gt; {
          // Convert screen names such as SimpleStack to kebab case (simple-stack)
          acc[name] = name
            .replace(/([A-Z]+)/g, '-$1')
            .replace(/^-/, '')
            .toLowerCase();

          return acc;
        },
        {}
      ),
    },
  });