Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Toast config not applied for InfoToast component #462

Closed
SocDario opened this issue Mar 25, 2023 · 2 comments
Closed

Toast config not applied for InfoToast component #462

SocDario opened this issue Mar 25, 2023 · 2 comments

Comments

@SocDario
Copy link

I have created toastConfig const in App.tsx like this:

const toastConfig = {
    success: (props: BaseToastProps) => (
      <BaseToast
        {...props}
        style={{height: 50}}
        text1Style={{
          color: Color.textPrimary,
          fontFamily: 'Oxygen-Regular',
        }}
        text2Style={{
          color: Color.primary,
          fontFamily: 'Oxygen-Regular',
        }}
        text2NumberOfLines={2}
        text1NumberOfLines={2}
      />
    ),

    error: (props: BaseToastProps) => (
      <ErrorToast
        {...props}
        style={{borderLeftColor: 'pink', height: 50}}
        text1Style={{
          color: Color.textPrimary,
          fontFamily: 'Oxygen-Regular',
        }}
        text2Style={{
          color: Color.textPrimary,
          fontFamily: 'Oxygen-Regular',
        }}
        text2NumberOfLines={2}
        text1NumberOfLines={2}
      />
    ),

    info: (props: BaseToastProps) => (
      <InfoToast
        {...props}
        text1Style={{
          color: Color.textPrimary,
          fontFamily: 'Oxygen-Regular',
        }}
        text2Style={{
          color: Color.primary,
          fontFamily: 'Oxygen-Regular',
        }}
        text2NumberOfLines={2}
        text1NumberOfLines={2}
      />
    ),
  };
  <ApolloProvider client={client}>
        <RootNavigator />
        <Toast config={toastConfig} />
  </ApolloProvider>

I have create hook for showing Toast inside my component, but hook is using i18n translation hook for text1 props.. expected behaviour is to show text1 into 2 lines without '...' tail. I have tested it without translation but textStyles and numberOfLines is not applied as it should be..After I removed defaultValue numberOflines=1 from lib code it works, but that is not solution ...

@snx-mfallon
Copy link

what was your solution?

@SocDario
Copy link
Author

@snx-mfallon I have made mistake in my code. Actually Toasts were working fine, but I initialised Toast once again for my Modal component and didn't pass specified configuration into newly initialised Toast.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants