Skip to content

Instantly share code, notes, and snippets.

@FanchenBao
Last active September 24, 2021 16:52
Show Gist options
  • Save FanchenBao/1b8123cf9d34936fae9e71602ef35ae3 to your computer and use it in GitHub Desktop.
Save FanchenBao/1b8123cf9d34936fae9e71602ef35ae3 to your computer and use it in GitHub Desktop.
Source code 01 used in medium article "Make Fastlane Snapshot Work with React Native"
import * as React from 'react';
import {View, TouchableHighlight, Text} from 'react-native';
import {env} from 'config.js';
export const DummyButton = (props: PropsT) => {
const {reduxCallback} = props;
if (env === 'prod') { // do not display dummy buttons in production release
return null;
}
// Notice the absolute position, unique test id, and transparent color
// on the text.
return (
<View style={{position: 'absolute'}}>
<TouchableHighlight
onPress={() => reduxCallback()}
testID="some_test_id">
<Text style={{color: 'rgba(0, 0, 0, 0'}}>01</Text>
</TouchableHighlight>
</View>
);
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment