xref: /expo/home/components/DevIndicator.tsx (revision acda41ac)
1import * as React from 'react';
2import { View, ViewProps } from 'react-native';
3
4export default function DevIndicator({
5  style,
6  isActive,
7  isNetworkAvailable,
8}: {
9  style: ViewProps['style'];
10  isActive?: boolean;
11  isNetworkAvailable?: boolean;
12}) {
13  const backgroundColor = React.useMemo(() => {
14    if (isActive && isNetworkAvailable) {
15      return '#00c100';
16    } else if (!isNetworkAvailable) {
17      return '#e0e057';
18    }
19    return '#ccc';
20  }, [isNetworkAvailable, isActive]);
21
22  return (
23    <View
24      style={[
25        {
26          width: 7,
27          height: 7,
28          backgroundColor,
29          borderRadius: 3.5,
30        },
31        style,
32      ]}
33    />
34  );
35}
36