mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
fix(rn-tester): text input and xml http request dark mode adjustments (#48207)
Summary: Was troubleshooting in these modules recently and noticed a few texts off in dark mode. Replacing a few instances of the Text component in all I could see in the two screens. ## Changelog: [INTERNAL] - RN Tester `TextInput` & `XMLHttpRequest` dark mode adjustments Pull Request resolved: https://github.com/facebook/react-native/pull/48207 Test Plan: <details> <summary>View Screenshots (before fixes)</summary> | Screenshot 1 | Screenshot 2 | Screenshot 3 | Screenshot 4 | Screenshot 5 | Screenshot 6 | |--------------|--------------|--------------|--------------|--------------|--------------| |  |  |  |  |  |  | |  |  |  |  | | | | </details> <details> <summary>View Screenshots (after fixes)</summary> | Screenshot 1 | Screenshot 2 | Screenshot 3 | Screenshot 4 | Screenshot 5 | Screenshot 6 | |--------------|--------------|--------------|--------------|--------------|--------------| |  |  |  |  |  |  | |  |  |  |  | | | </details> Reviewed By: cipolleschi Differential Revision: D67087492 Pulled By: javache fbshipit-source-id: c9c64377d8c10d965bc5db7783aa80f099ce858a
This commit is contained in:
committed by
Facebook GitHub Bot
parent
dffa57fa25
commit
79ed11f8f4
@@ -12,6 +12,7 @@
|
||||
|
||||
import type {RNTesterModule} from '../../types/RNTesterTypes';
|
||||
|
||||
import RNTesterText from '../../components/RNTesterText';
|
||||
import TextLegend from '../../components/TextLegend';
|
||||
import TextInlineViewsExample from './TextInlineViewsExample';
|
||||
|
||||
@@ -1350,9 +1351,9 @@ const examples = [
|
||||
return (
|
||||
<View key={code}>
|
||||
<Text style={{fontWeight: 'bold'}}>{`[${code}]`}</Text>
|
||||
<Text lineBreakStrategyIOS={strategy}>
|
||||
<RNTesterText lineBreakStrategyIOS={strategy}>
|
||||
{textByCode[code]}
|
||||
</Text>
|
||||
</RNTesterText>
|
||||
</View>
|
||||
);
|
||||
})}
|
||||
|
||||
@@ -16,6 +16,7 @@ import type {
|
||||
} from '../../types/RNTesterTypes';
|
||||
import type {KeyboardType} from 'react-native/Libraries/Components/TextInput/TextInput';
|
||||
|
||||
import RNTesterText from '../../components/RNTesterText';
|
||||
import ExampleTextInput from './ExampleTextInput';
|
||||
|
||||
const TextInputSharedExamples = require('./TextInputSharedExamples.js');
|
||||
@@ -36,7 +37,7 @@ class WithLabel extends React.Component<$FlowFixMeProps> {
|
||||
return (
|
||||
<View style={styles.labelContainer}>
|
||||
<View style={styles.label}>
|
||||
<Text>{this.props.label}</Text>
|
||||
<RNTesterText>{this.props.label}</RNTesterText>
|
||||
</View>
|
||||
{this.props.children}
|
||||
</View>
|
||||
@@ -58,7 +59,9 @@ class TextInputAccessoryViewChangeTextExample extends React.Component<
|
||||
const inputAccessoryViewID = 'inputAccessoryView1';
|
||||
return (
|
||||
<View>
|
||||
<Text>Set InputAccessoryView with ID & reset text:</Text>
|
||||
<RNTesterText>
|
||||
Set InputAccessoryView with ID & reset text:
|
||||
</RNTesterText>
|
||||
<ExampleTextInput
|
||||
inputAccessoryViewID={inputAccessoryViewID}
|
||||
onChangeText={text => this.setState({text})}
|
||||
@@ -98,7 +101,9 @@ class TextInputAccessoryViewChangeKeyboardExample extends React.Component<
|
||||
const inputAccessoryViewID = 'inputAccessoryView2';
|
||||
return (
|
||||
<View>
|
||||
<Text>Set InputAccessoryView with ID & switch keyboard:</Text>
|
||||
<RNTesterText>
|
||||
Set InputAccessoryView with ID & switch keyboard:
|
||||
</RNTesterText>
|
||||
{/* $FlowFixMe[incompatible-use] */}
|
||||
<ExampleTextInput
|
||||
inputAccessoryViewID={inputAccessoryViewID}
|
||||
@@ -180,7 +185,7 @@ class SecureEntryExample extends React.Component<$FlowFixMeProps, any> {
|
||||
onChangeText={text => this.setState({text})}
|
||||
value={this.state.text}
|
||||
/>
|
||||
<Text>Current text is: {this.state.text}</Text>
|
||||
<RNTesterText>Current text is: {this.state.text}</RNTesterText>
|
||||
<View
|
||||
style={{
|
||||
flex: 1,
|
||||
@@ -233,19 +238,19 @@ class AutogrowingTextInputExample extends React.Component<
|
||||
const {style, multiline, ...props} = this.props;
|
||||
return (
|
||||
<View>
|
||||
<Text>Full width:</Text>
|
||||
<RNTesterText>Full width:</RNTesterText>
|
||||
<Switch
|
||||
value={this.state.fullWidth}
|
||||
onValueChange={value => this.setState({fullWidth: value})}
|
||||
/>
|
||||
|
||||
<Text>Multiline:</Text>
|
||||
<RNTesterText>Multiline:</RNTesterText>
|
||||
<Switch
|
||||
value={this.state.multiline}
|
||||
onValueChange={value => this.setState({multiline: value})}
|
||||
/>
|
||||
|
||||
<Text>TextInput:</Text>
|
||||
<RNTesterText>TextInput:</RNTesterText>
|
||||
<ExampleTextInput
|
||||
value="prop"
|
||||
multiline={this.state.multiline}
|
||||
@@ -256,9 +261,11 @@ class AutogrowingTextInputExample extends React.Component<
|
||||
}
|
||||
{...props}
|
||||
/>
|
||||
<Text>Plain text value representation:</Text>
|
||||
<Text>{this.state.text}</Text>
|
||||
<Text>Content Size: {JSON.stringify(this.state.contentSize)}</Text>
|
||||
<RNTesterText>Plain text value representation:</RNTesterText>
|
||||
<RNTesterText>{this.state.text}</RNTesterText>
|
||||
<RNTesterText>
|
||||
Content Size: {JSON.stringify(this.state.contentSize)}
|
||||
</RNTesterText>
|
||||
</View>
|
||||
);
|
||||
}
|
||||
@@ -655,7 +662,7 @@ const textInputExamples: Array<RNTesterModuleExample> = [
|
||||
render: function (): React.Node {
|
||||
return (
|
||||
<View>
|
||||
<Text>Singleline TextInput</Text>
|
||||
<RNTesterText>Singleline TextInput</RNTesterText>
|
||||
<View style={{height: 80}}>
|
||||
<ExampleTextInput
|
||||
style={{
|
||||
@@ -674,8 +681,8 @@ const textInputExamples: Array<RNTesterModuleExample> = [
|
||||
placeholder="Placeholder defines intrinsic size"
|
||||
/>
|
||||
</View>
|
||||
<Text>Multiline TextInput</Text>
|
||||
<View style={{height: 130}}>
|
||||
<RNTesterText>Multiline TextInput</RNTesterText>
|
||||
<View style={{height: 80}}>
|
||||
<ExampleTextInput
|
||||
style={{
|
||||
position: 'absolute',
|
||||
@@ -695,6 +702,7 @@ const textInputExamples: Array<RNTesterModuleExample> = [
|
||||
placeholder="Placeholder defines intrinsic size"
|
||||
/>
|
||||
</View>
|
||||
<RNTesterText>Multiline TextInput with flex</RNTesterText>
|
||||
<View>
|
||||
<ExampleTextInput
|
||||
style={{
|
||||
@@ -887,7 +895,10 @@ const textInputExamples: Array<RNTesterModuleExample> = [
|
||||
{Object.keys(textByCode).map(code => {
|
||||
return (
|
||||
<View key={code}>
|
||||
<Text style={{fontWeight: 'bold'}}>{`[${code}]`}</Text>
|
||||
<RNTesterText
|
||||
style={{
|
||||
fontWeight: 'bold',
|
||||
}}>{`[${code}]`}</RNTesterText>
|
||||
<ExampleTextInput
|
||||
multiline
|
||||
lineBreakStrategyIOS={strategy}
|
||||
@@ -954,7 +965,10 @@ const textInputExamples: Array<RNTesterModuleExample> = [
|
||||
{Object.keys(textByCode).map(code => {
|
||||
return (
|
||||
<View key={code}>
|
||||
<Text style={{fontWeight: 'bold'}}>{`[${code}]`}</Text>
|
||||
<RNTesterText
|
||||
style={{
|
||||
fontWeight: 'bold',
|
||||
}}>{`[${code}]`}</RNTesterText>
|
||||
<ExampleTextInput
|
||||
lineBreakModeIOS={strategy}
|
||||
defaultValue={textByCode[code]}
|
||||
|
||||
@@ -14,6 +14,7 @@ import type {RNTesterModuleExample} from '../../types/RNTesterTypes';
|
||||
import type {TextStyle} from 'react-native/Libraries/StyleSheet/StyleSheet';
|
||||
|
||||
import RNTesterButton from '../../components/RNTesterButton';
|
||||
import RNTesterText from '../../components/RNTesterText';
|
||||
import {RNTesterThemeContext} from '../../components/RNTesterTheme';
|
||||
import ExampleTextInput from './ExampleTextInput';
|
||||
import * as React from 'react';
|
||||
@@ -114,7 +115,7 @@ class WithLabel extends React.Component<$FlowFixMeProps> {
|
||||
render(): React.Node {
|
||||
return (
|
||||
<View style={styles.labelContainer}>
|
||||
<Text style={styles.label}>{this.props.label}</Text>
|
||||
<RNTesterText style={styles.label}>{this.props.label}</RNTesterText>
|
||||
<View style={styles.inputContainer}>{this.props.children}</View>
|
||||
</View>
|
||||
);
|
||||
@@ -417,13 +418,13 @@ class TextEventsExample extends React.Component<{...}, $FlowFixMeState> {
|
||||
}
|
||||
style={styles.singleLine}
|
||||
/>
|
||||
<Text style={styles.eventLabel}>
|
||||
<RNTesterText style={styles.eventLabel}>
|
||||
{this.state.curText}
|
||||
{'\n'}
|
||||
(prev: {this.state.prevText}){'\n'}
|
||||
(prev2: {this.state.prev2Text}){'\n'}
|
||||
(prev3: {this.state.prev3Text})
|
||||
</Text>
|
||||
</RNTesterText>
|
||||
</View>
|
||||
);
|
||||
}
|
||||
@@ -571,34 +572,38 @@ class SelectionExample extends React.Component<
|
||||
/>
|
||||
</View>
|
||||
<View>
|
||||
<Text testID={`${this.props.testID}-selection`}>
|
||||
<RNTesterText testID={`${this.props.testID}-selection`}>
|
||||
selection ={' '}
|
||||
{`{start:${this.state.selection.start},end:${this.state.selection.end}}`}
|
||||
</Text>
|
||||
<Text
|
||||
</RNTesterText>
|
||||
<RNTesterText
|
||||
testID={`${this.props.testID}-cursor-start`}
|
||||
// $FlowFixMe[method-unbinding] added when improving typing for this parameters
|
||||
onPress={this.placeAt.bind(this, 0)}>
|
||||
Place at Start (0, 0)
|
||||
</Text>
|
||||
<Text
|
||||
</RNTesterText>
|
||||
<RNTesterText
|
||||
testID={`${this.props.testID}-cursor-end`}
|
||||
// $FlowFixMe[method-unbinding] added when improving typing for this parameters
|
||||
onPress={this.placeAt.bind(this, length)}>
|
||||
Place at End ({length}, {length})
|
||||
</Text>
|
||||
</RNTesterText>
|
||||
{/* $FlowFixMe[method-unbinding] added when improving typing for this
|
||||
* parameters */}
|
||||
<Text onPress={this.placeAtRandom.bind(this)}>Place at Random</Text>
|
||||
<Text
|
||||
<RNTesterText onPress={this.placeAtRandom.bind(this)}>
|
||||
Place at Random
|
||||
</RNTesterText>
|
||||
<RNTesterText
|
||||
testID={`${this.props.testID}-select-all`}
|
||||
// $FlowFixMe[method-unbinding] added when improving typing for this parameters
|
||||
onPress={this.select.bind(this, 0, length)}>
|
||||
Select All
|
||||
</Text>
|
||||
</RNTesterText>
|
||||
{/* $FlowFixMe[method-unbinding] added when improving typing for this
|
||||
* parameters */}
|
||||
<Text onPress={this.selectRandom.bind(this)}>Select Random</Text>
|
||||
<RNTesterText onPress={this.selectRandom.bind(this)}>
|
||||
Select Random
|
||||
</RNTesterText>
|
||||
</View>
|
||||
</View>
|
||||
);
|
||||
@@ -855,7 +860,7 @@ function DynamicContentWidth() {
|
||||
|
||||
return (
|
||||
<View>
|
||||
<Text>Uncontrolled:</Text>
|
||||
<RNTesterText>Uncontrolled:</RNTesterText>
|
||||
<TextInput
|
||||
placeholder="Type..."
|
||||
style={{
|
||||
@@ -864,7 +869,7 @@ function DynamicContentWidth() {
|
||||
backgroundColor: 'orange',
|
||||
}}
|
||||
/>
|
||||
<Text>Controlled:</Text>
|
||||
<RNTesterText>Controlled:</RNTesterText>
|
||||
<TextInput
|
||||
placeholder="..."
|
||||
value={text}
|
||||
|
||||
@@ -10,17 +10,17 @@
|
||||
|
||||
'use strict';
|
||||
|
||||
import RNTesterText from '../../components/RNTesterText';
|
||||
import RNTOption from '../../components/RNTOption';
|
||||
|
||||
const React = require('react');
|
||||
const {
|
||||
import React from 'react';
|
||||
import {
|
||||
Alert,
|
||||
Linking,
|
||||
StyleSheet,
|
||||
Text,
|
||||
TouchableHighlight,
|
||||
View,
|
||||
} = require('react-native');
|
||||
} from 'react-native';
|
||||
|
||||
const BINARY_TYPES = {
|
||||
String,
|
||||
@@ -112,7 +112,9 @@ class XHRExampleBinaryUpload extends React.Component<{...}, $FlowFixMeState> {
|
||||
return (
|
||||
<View>
|
||||
<View style={styles.block}>
|
||||
<Text style={styles.title}>Upload 255 bytes as ...</Text>
|
||||
<RNTesterText style={styles.title}>
|
||||
Upload 255 bytes as ...
|
||||
</RNTesterText>
|
||||
<View style={styles.row}>
|
||||
{Object.keys(BINARY_TYPES).map(type => (
|
||||
<RNTOption
|
||||
|
||||
@@ -10,6 +10,8 @@
|
||||
|
||||
'use strict';
|
||||
|
||||
import RNTesterText from '../../components/RNTesterText';
|
||||
|
||||
const React = require('react');
|
||||
const {
|
||||
Alert,
|
||||
@@ -162,10 +164,10 @@ class XHRExampleDownload extends React.Component<{...}, Object> {
|
||||
const {responseLength, contentLength} = this.state;
|
||||
readystate = (
|
||||
<View>
|
||||
<Text style={styles.progressBarLabel}>
|
||||
<RNTesterText style={styles.progressBarLabel}>
|
||||
responseText: {roundKilo(responseLength)}/{roundKilo(contentLength)}
|
||||
k chars
|
||||
</Text>
|
||||
</RNTesterText>
|
||||
</View>
|
||||
);
|
||||
}
|
||||
@@ -173,10 +175,10 @@ class XHRExampleDownload extends React.Component<{...}, Object> {
|
||||
const {progressLoaded, progressTotal} = this.state;
|
||||
progress = (
|
||||
<View>
|
||||
<Text style={styles.progressBarLabel}>
|
||||
<RNTesterText style={styles.progressBarLabel}>
|
||||
onprogress: {roundKilo(progressLoaded)}/{roundKilo(progressTotal)}{' '}
|
||||
KB
|
||||
</Text>
|
||||
</RNTesterText>
|
||||
</View>
|
||||
);
|
||||
}
|
||||
@@ -184,7 +186,7 @@ class XHRExampleDownload extends React.Component<{...}, Object> {
|
||||
return (
|
||||
<View>
|
||||
<View style={styles.configRow}>
|
||||
<Text>onreadystatechange handler</Text>
|
||||
<RNTesterText>onreadystatechange handler</RNTesterText>
|
||||
<Switch
|
||||
value={this.state.readystateHandler}
|
||||
onValueChange={readystateHandler =>
|
||||
@@ -193,21 +195,21 @@ class XHRExampleDownload extends React.Component<{...}, Object> {
|
||||
/>
|
||||
</View>
|
||||
<View style={styles.configRow}>
|
||||
<Text>onprogress handler</Text>
|
||||
<RNTesterText>onprogress handler</RNTesterText>
|
||||
<Switch
|
||||
value={this.state.progressHandler}
|
||||
onValueChange={progressHandler => this.setState({progressHandler})}
|
||||
/>
|
||||
</View>
|
||||
<View style={styles.configRow}>
|
||||
<Text>download as arraybuffer</Text>
|
||||
<RNTesterText>download as arraybuffer</RNTesterText>
|
||||
<Switch
|
||||
value={this.state.arraybuffer}
|
||||
onValueChange={arraybuffer => this.setState({arraybuffer})}
|
||||
/>
|
||||
</View>
|
||||
<View style={styles.configRow}>
|
||||
<Text>transfer-encoding: chunked</Text>
|
||||
<RNTesterText>transfer-encoding: chunked</RNTesterText>
|
||||
<Switch
|
||||
value={this.state.chunked}
|
||||
onValueChange={chunked => this.setState({chunked})}
|
||||
|
||||
@@ -10,15 +10,16 @@
|
||||
|
||||
'use strict';
|
||||
|
||||
const React = require('react');
|
||||
const {
|
||||
import {RNTesterThemeContext} from '../../components/RNTesterTheme';
|
||||
import React from 'react';
|
||||
import {
|
||||
Button,
|
||||
Platform,
|
||||
StyleSheet,
|
||||
Text,
|
||||
TextInput,
|
||||
View,
|
||||
} = require('react-native');
|
||||
} from 'react-native';
|
||||
|
||||
class XHRExampleFetch extends React.Component<any, any> {
|
||||
responseURL: ?string;
|
||||
@@ -113,24 +114,33 @@ class XHRExampleFetch extends React.Component<any, any> {
|
||||
) : null;
|
||||
|
||||
return (
|
||||
<View>
|
||||
<Button
|
||||
title="RepeatedlyFetch"
|
||||
onPress={() => this.startRepeatedlyFetch()}
|
||||
/>
|
||||
<Text style={styles.label}>Edit URL to submit:</Text>
|
||||
<TextInput
|
||||
returnKeyType="go"
|
||||
defaultValue="http://www.posttestserver.com/post.php"
|
||||
onSubmitEditing={event => {
|
||||
this.submit(event.nativeEvent.text);
|
||||
}}
|
||||
style={styles.textInput}
|
||||
/>
|
||||
{responseURL}
|
||||
{responseHeaders}
|
||||
{response}
|
||||
</View>
|
||||
<RNTesterThemeContext.Consumer>
|
||||
{theme => (
|
||||
<>
|
||||
<Button
|
||||
title="RepeatedlyFetch"
|
||||
onPress={() => this.startRepeatedlyFetch()}
|
||||
/>
|
||||
<Text style={styles.label}>Edit URL to submit:</Text>
|
||||
<TextInput
|
||||
returnKeyType="go"
|
||||
defaultValue="http://www.posttestserver.com/post.php"
|
||||
onSubmitEditing={event => {
|
||||
this.submit(event.nativeEvent.text);
|
||||
}}
|
||||
style={[
|
||||
styles.textInput,
|
||||
{
|
||||
color: theme.LabelColor,
|
||||
},
|
||||
]}
|
||||
/>
|
||||
{responseURL}
|
||||
{responseHeaders}
|
||||
{response}
|
||||
</>
|
||||
)}
|
||||
</RNTesterThemeContext.Consumer>
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,8 +10,9 @@
|
||||
|
||||
'use strict';
|
||||
|
||||
const React = require('react');
|
||||
const {StyleSheet, Text, TouchableHighlight, View} = require('react-native');
|
||||
import RNTesterText from '../../components/RNTesterText';
|
||||
import React from 'react';
|
||||
import {StyleSheet, Text, TouchableHighlight, View} from 'react-native';
|
||||
|
||||
class XHRExampleHeaders extends React.Component {
|
||||
xhr: XMLHttpRequest;
|
||||
@@ -94,7 +95,7 @@ class XHRExampleHeaders extends React.Component {
|
||||
return (
|
||||
<View>
|
||||
{button}
|
||||
<Text>{this.state.headers}</Text>
|
||||
<RNTesterText>{this.state.headers}</RNTesterText>
|
||||
</View>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -10,6 +10,8 @@
|
||||
|
||||
'use strict';
|
||||
|
||||
import RNTesterText from '../../components/RNTesterText';
|
||||
|
||||
const React = require('react');
|
||||
const {StyleSheet, Text, TouchableHighlight, View} = require('react-native');
|
||||
|
||||
@@ -79,7 +81,7 @@ class XHRExampleOnTimeOut extends React.Component<any, any> {
|
||||
return (
|
||||
<View>
|
||||
{button}
|
||||
<Text>{this.state.status}</Text>
|
||||
<RNTesterText>{this.state.status}</RNTesterText>
|
||||
</View>
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user