Skip to content

Commit b9ac73d

Browse files
authored
Merge pull request microsoft#6 from amgleitman/amgleitman/fb66merge-more-fixes
More fixes to RNTester Xcode tests
2 parents c5d4fe8 + b1eaf18 commit b9ac73d

File tree

2 files changed

+52
-29
lines changed

2 files changed

+52
-29
lines changed

Libraries/Animated/AnimatedMock.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,12 @@ const spring = function(
5656
return {
5757
...emptyAnimation,
5858
start: (callback?: ?EndCallback): void => {
59-
anyValue.setValue(config.toValue);
59+
// TODO(macOS GH#774) - setValue can't handle AnimatedNodes
60+
if (config.toValue instanceof AnimatedNode) {
61+
anyValue.setValue(config.toValue.__getValue());
62+
} else {
63+
anyValue.setValue(config.toValue);
64+
}
6065
callback && callback({finished: true});
6166
},
6267
};

packages/rn-tester/js/examples/Accessibility/AccessibilityExample.js

Lines changed: 46 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -716,26 +716,28 @@ class AccessibilityActionsExample extends React.Component<{}> {
716716
/>
717717
</RNTesterBlock>
718718

719-
<RNTesterBlock title="Text with custom accessibility actions">
720-
<Text
721-
accessible={true}
722-
accessibilityActions={[
723-
{name: 'activate', label: 'activate label'},
724-
{name: 'copy', label: 'copy label'},
725-
]}
726-
onAccessibilityAction={event => {
727-
switch (event.nativeEvent.actionName) {
728-
case 'activate':
729-
Alert.alert('Alert', 'Activate accessiblity action');
730-
break;
731-
case 'copy':
732-
Alert.alert('Alert', 'copy action success');
733-
break;
734-
}
735-
}}>
736-
Text
737-
</Text>
738-
</RNTesterBlock>
719+
{/* TODO(macOS GH#774) - This doesn't work, see https://github.com/facebook/react-native/issues/32616
720+
<RNTesterBlock title="Text with custom accessibility actions">
721+
<Text
722+
accessible={true}
723+
accessibilityActions={[
724+
{name: 'activate', label: 'activate label'},
725+
{name: 'copy', label: 'copy label'},
726+
]}
727+
onAccessibilityAction={event => {
728+
switch (event.nativeEvent.actionName) {
729+
case 'activate':
730+
Alert.alert('Alert', 'Activate accessiblity action');
731+
break;
732+
case 'copy':
733+
Alert.alert('Alert', 'copy action success');
734+
break;
735+
}
736+
}}>
737+
Text
738+
</Text>
739+
</RNTesterBlock>
740+
*/}
739741
</View>
740742
);
741743
}
@@ -962,15 +964,22 @@ class EnabledExamples extends React.Component<{}> {
962964
}
963965
// [TODO(OSS Candidate ISS#2710739)
964966
type DisplayOptionsStatusExampleState = {
965-
highContrastEnabled: boolean,
966-
invertColorsEnabled: boolean,
967-
reduceMotionEnabled: boolean,
968-
reduceTransparencyEnabled: boolean,
967+
highContrastEnabled?: boolean,
968+
invertColorsEnabled?: boolean,
969+
reduceMotionEnabled?: boolean,
970+
reduceTransparencyEnabled?: boolean,
969971
};
970972
class DisplayOptionsStatusExample extends React.Component<
971973
{},
972974
DisplayOptionsStatusExampleState,
973975
> {
976+
state: DisplayOptionsStatusExampleState = {
977+
highContrastEnabled: undefined,
978+
invertColorsEnabled: undefined,
979+
reduceMotionEnabled: undefined,
980+
reduceTransparencyEnabled: undefined,
981+
};
982+
974983
componentDidMount() {
975984
AccessibilityInfo.addEventListener(
976985
'highContrastChanged',
@@ -1056,31 +1065,40 @@ class DisplayOptionsStatusExample extends React.Component<
10561065
});
10571066
};
10581067

1068+
// TODO(macOS GH#774) - slight refactoring to allow state to handle undefined values
1069+
_statusString = isEnabled => {
1070+
if (isEnabled !== undefined) {
1071+
return isEnabled ? 'enabled' : 'disabled';
1072+
} else {
1073+
return 'unknown';
1074+
}
1075+
};
1076+
10591077
render(): React.Node {
10601078
return (
10611079
<View>
10621080
<View>
10631081
<Text>
10641082
High contrast is{' '}
1065-
{this.state.highContrastEnabled ? 'enabled' : 'disabled'}.
1083+
{this._statusString(this.state.highContrastEnabled)}.
10661084
</Text>
10671085
</View>
10681086
<View>
10691087
<Text>
10701088
Invert colors is{' '}
1071-
{this.state.invertColorsEnabled ? 'enabled' : 'disabled'}.
1089+
{this._statusString(this.state.invertColorsEnabled)}.
10721090
</Text>
10731091
</View>
10741092
<View>
10751093
<Text>
10761094
Reduce motion is{' '}
1077-
{this.state.reduceMotionEnabled ? 'enabled' : 'disabled'}.
1095+
{this._statusString(this.state.reduceMotionEnabled)}.
10781096
</Text>
10791097
</View>
10801098
<View>
10811099
<Text>
10821100
Reduce transparency is{' '}
1083-
{this.state.reduceTransparencyEnabled ? 'enabled' : 'disabled'}.
1101+
{this._statusString(this.state.reduceTransparencyEnabled)}.
10841102
</Text>
10851103
</View>
10861104
</View>

0 commit comments

Comments
 (0)