How to use react-native-safe-area-context - 10 common examples

To help you get started, we’ve selected a few react-native-safe-area-context 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 / components / main / CreateGroupFinalize.tsx View on Github external
}> = ({ members, onRemoveMember }) => {
	const { goBack, reset } = useNativeNavigation()
	const [groupName, setGroupName] = useState('New group')
	const { call, error, done, reply } = (messengerMethodsHooks as any).useConversationCreate()

	const createGroup = React.useCallback(
		() => call({ displayName: groupName, contactsToInvite: members.map((m) => m.publicKey) }),
		[groupName, members, call],
	)
	const [layout, setLayout] = useState(0)
	const [{ flex, background, padding }] = useStyles()
	const ctx = useMsgrContext()
	const insets = useSafeAreaInsets()
	const { t }: { t: any } = useTranslation()

	React.useEffect(() => {
		// TODO: better handle error
		if (done) {
			if (error) {
				console.error('Failed to create group:', error)
			} else if (reply?.publicKey) {
				reset({
					index: 0,
					routes: [
						{
							name: Routes.Main.Home,
						},
						{
							name: Routes.Chat.Group,
github berty / berty / js / packages / components / chat / OneToOne.tsx View on Github external
export const ChatHeader: React.FC<{ convPk: any; stickyDate: any; showStickyDate: any }> = ({
	convPk,
	stickyDate,
	showStickyDate,
}) => {
	const insets = useSafeAreaInsets()
	const { navigate, goBack } = useNavigation()
	const conv = useConversation(convPk)
	const contact = useContact(conv?.contactPublicKey || null)

	const [{ flex, padding, text, opacity, color, row }, { scaleSize }] = useStyles()

	const [layoutHeader, onLayoutHeader] = useLayout() // to position date under blur

	if (!conv || !contact) {
		goBack()
		console.warn('OneToOne: no conv', conv, contact)
		return 
	}
	const title = (conv as any).fake ? `FAKE - ${contact.displayName}` : contact?.displayName || ''
	return (
github EvanBacon / Expo-Crossy-Road / screens / GameOverScreen.js View on Github external
//     this.setState({result: 'shared with an activityType: ' + result.activityType});
    //   } else {
    //     this.setState({result: 'shared'});
    //   }
    // } else if (result.action === Share.dismissedAction) {
    //   this.setState({result: 'dismissed'});
    // }
  };

  const select = () => {

    // props.setCharacter(characters[currentIndex]);
    dismiss();
  };

  const { top, bottom, left, right } = useSafeArea();

  const imageStyle = { width: 60, height: 48 };

  return (
github EvanBacon / Expo-Crossy-Road / components / ScoreText.js View on Github external
function Score({ gameOver, score, highScore, ...props }) {

  React.useEffect(() => {
    if (gameOver) {
      if (score > highScore) {
        // setHighScore(score);
      }


    }
  }, [gameOver])


  const { top, left } = useSafeArea();

  return (
github berty / berty / js / packages / components / chat / MultiMember.tsx View on Github external
}> = ({ id, stickyDate, showStickyDate }) => {
	const { navigate, goBack } = useNavigation()
	const insets = useSafeAreaInsets()
	const [{ row, padding, flex, text, color }, { scaleSize }] = useStyles()
	const conversation = useConversation(id)
	const [layoutHeader, onLayoutHeader] = useLayout() // to position date under blur

	return (
github expo / expo / apps / test-suite / components / RunnerError.js View on Github external
export default function RunnerError({ children }) {
  const { top } = useSafeArea();

  return (
    
  );
}
github syousif94 / frugalmaps / buncha / components / EventList.js View on Github external
const MenuButton = () => {
  const insets = useSafeArea();
  return (
github EvanBacon / Sunset-Cyberspace / screens / LicensesScreen.js View on Github external
export default function LicensesScreen({ navigation }) {
  const [top, left, bottom, right] = useSafeArea();
  return (
github react-navigation / navigation-ex / packages / drawer / src / views / DrawerNavigatorItems.tsx View on Github external
activeTintColor,
  activeBackgroundColor,
  inactiveTintColor,
  inactiveBackgroundColor,
  getLabel,
  renderIcon,
  onItemPress,
  itemsContainerStyle,
  itemStyle,
  labelStyle,
  activeLabelStyle,
  inactiveLabelStyle,
  iconContainerStyle,
  drawerPosition,
}: DrawerNavigationItemsProps) => {
  const insets = useSafeArea();

  return (
github wcandillon / can-it-be-done-in-react-native / season3 / src / UberEats / Header.tsx View on Github external
export default ({ y, tabs, scrollView }: HeaderProps) => {
  const { goBack } = useNavigation();
  const [toggle] = useValues<0 | 1>([0], []);
  const insets = useSafeArea();
  const transition = withTimingTransition(toggle, { duration: 100 });
  const { top: paddingTop } = insets;
  const translateX = interpolate(y, {
    inputRange: [0, HEADER_IMAGE_HEIGHT],
    outputRange: [-ICON_SIZE - PADDING, 0],
    extrapolate: Extrapolate.CLAMP
  });
  const translateY = interpolate(y, {
    inputRange: [-100, 0, HEADER_IMAGE_HEIGHT],
    outputRange: [
      HEADER_IMAGE_HEIGHT - MIN_HEADER_HEIGHT + 100,
      HEADER_IMAGE_HEIGHT - MIN_HEADER_HEIGHT,
      0
    ],
    extrapolateRight: Extrapolate.CLAMP
  });

react-native-safe-area-context

A flexible way to handle safe area, also works on Android and web.

MIT
Latest version published 30 days ago

Package Health Score

86 / 100
Full package analysis