How to use the react-native.Platform.OS function in react-native

To help you get started, we’ve selected a few react-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 jiasongs / cnodeRN / src / page / Find / find.js View on Github external
},
  headerView: {
    flex: 1,
    width: 375,
    justifyContent: 'center',
    alignItems: 'center',
    backgroundColor: '#3c5e91',
    marginTop: 0,
    zIndex: 999
  },
  searchBarView: {
    backgroundColor: "#2D2D2D",
    height: searchBarHeight,
    paddingTop: Platform.OS == 'android' ? 0 : (height == 815 ? 37 : 27),
    paddingLeft: 15,
    justifyContent: Platform.OS == 'android' ? 'center' : 'flex-start',
    // opacity: 0.5,
  },
  titleView: {
    marginBottom: 15
  },
  title: {
    color: "#999999",
    fontSize: FONT_SIZE(12)
  },
  contentContainerStyle: {
    flexDirection: 'row',//设置横向布局
    flexWrap: 'wrap',
    justifyContent: 'space-between',
    // backgroundColor: 'blue'
  },
  hotsRow: {
github mini-eggs / Flippour / src / configs / modal.js View on Github external
import { Text, Button } from "native-base";
import { connect } from "react-redux";
import { SettingsDecorator } from "../decorators/settings";
import { ModalActions } from "../actions/";

const styles = {
  ToastContainer: {
    position: "absolute",
    zIndex: 99,
    top: 0,
    width: Dimensions.get("window").width,
    alignItems: "stretch"
  },
  Background: {
    backgroundColor: "#c3524c",
    paddingTop: Platform.OS === "ios" ? 22 : 10,
    paddingBottom: 10
  },
  Text: {
    color: "white",
    textAlign: "center"
  }
};

// @SoundDecorator(["notification_in"])
@SettingsDecorator()
class ModalComponent extends Component {
  animation = {
    fadeAnim: new Animated.Value(0),
    positionAnim: new Animated.Value(-50)
  };
github expo / expo / home / api / ApiV2HttpClient.ts View on Github external
async _requestAsync(methodName: string, options: RequestOptions): Promise {
    let url = `${Config.api.host}/--/api/v2/${encodeURI(methodName)}`;
    if (options.queryParameters) {
      url += '?' + querystring.stringify(options.queryParameters);
    }

    let { session } = Store.getState();
    let fetchOptions: any = {
      method: options.httpMethod,
      headers: {
        'Expo-SDK-Version': Kernel.sdkVersions,
        'Expo-Platform': Platform.OS,
        ...(session.sessionSecret ? { 'expo-session': session.sessionSecret } : null),
      },
    };
    if (options.body) {
      fetchOptions.headers['Content-Type'] = 'application/json';
      fetchOptions.body = JSON.stringify(options.body);
    }

    // We expect the result to be JSON
    let response = await fetch(url, fetchOptions);
    let resultText = await response.text();
    let result: any;
    try {
      result = JSON.parse(resultText);
    } catch (e) {
      let error: any = new Error(`There was a problem understanding the server.`);
github yeelone / yeetiku-mobile-rn / src / screens / market / TagsScreen.js View on Github external
shadowColor: 'black',
            shadowOpacity: 0.1,
            shadowRadius: 10,
            shadowOffset: { height:0, width: 0},
        },
        android: {
            elevation:5
        }
    })
},
  tagItem:{
    margin:5,
    backgroundColor:"#dfe6e9"
  },
  headerBar:{
    paddingTop:Platform.OS === 'ios' ? 25 : StatusBar.currentHeight + 10  ,
    paddingBottom:10,
    height:70,
    backgroundColor:colors.theme,
  }
});
github wkl007 / GitHubPopular / src / pages / CustomTheme.js View on Github external
const styles = StyleSheet.create({
  themeItem: {
    flex: 1,
    height: 120,
    margin: 3,
    padding: 3,
    borderRadius: 2,
    alignItems: 'center',
    justifyContent: 'center',
  },
  modalContainer: {
    flex: 1,
    margin: 10,
    marginBottom: 10 + (DeviceInfo.isIPhoneX_deprecated ? 24 : 0),
    marginTop: Platform.OS === 'ios' ? 20 + (DeviceInfo.isIPhoneX_deprecated ? 24 : 0) : 10,
    backgroundColor: 'white',
    borderRadius: 3,
    shadowColor: 'gray',
    shadowOffset: { width: 2, height: 2 },
    shadowOpacity: 0.5,
    shadowRadius: 2,
    padding: 3
  },
  themeText: {
    color: 'white',
    fontWeight: '500',
    fontSize: 16
  }
})
github react-native-elements / react-native-elements-app / src / views / ratings.js View on Github external
headingContainer: {
    paddingTop: 50,
  },
  titleText: {
    fontSize: 25,
    fontWeight: 'bold',
    textAlign: 'center',
    paddingVertical: 5,
    fontFamily: Platform.OS === 'ios' ? 'Menlo-Bold' : null,
    color: '#27ae60',
  },
  subtitleText: {
    fontSize: 18,
    fontWeight: '400',
    textAlign: 'center',
    fontFamily: Platform.OS === 'ios' ? 'Trebuchet MS' : null,
    color: '#34495e',
  },
  viewContainer: {
    flex: 1,
  },
});

export default Ratings;
github kenjdavidson / react-native-bluetooth-classic / src / index.js View on Github external
constructor(nativeModule) {
    super(nativeModule)

    if (Platform.OS === 'android') this._nativeModule = nativeModule;

    this.setAdapterName = nativeModule.setAdapterName;
    this.requestEnable = nativeModule.requestEnable;
    this.isEnabled = nativeModule.isEnabled;
    this.list = nativeModule.list;
    this.discoverDevices = nativeModule.discoverDevices;
    this.cancelDiscovery = nativeModule.cancelDiscovery;
    this.pairDevice = nativeModule.pairDevice;
    this.unpairDevice = nativeModule.unpairDevice;

    this.connect = nativeModule.connect;
    this.disconnect = nativeModule.disconnect;
    this.isConnected = nativeModule.isConnected;
    this.getConnectedDevice = nativeModule.getConnectedDevice;

    this.writeToDevice = nativeModule.writeToDevice;
github steniowagner / mindCast / src / components / screens / library / routes.js View on Github external
navigationOptions: ({ navigation, screenProps }) => getDefaultHeaderWithButton(
        navigation,
        screenProps,
        'Recently Played',
        'play-circle-outline',
      ),
    },

    [CONSTANTS.ROUTES.INTERESTS]: {
      screen: Interests,
      navigationOptions: ({ navigation, screenProps }) => getDefaultHeaderWithTitle('Your Interests', navigation, screenProps),
    },
  },
  {
    initialRouteName: CONSTANTS.ROUTES.LIBRARY,
    mode: Platform.OS === 'ios' ? 'card' : 'modal',
    headerLayoutPreset: 'center',
    headerMode: 'screen',
  },
);

export default RootStack;