mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
Summary: Fix typos in: - `Libraries/Renderer/implementations/ReactFabric-dev.js`: transfered -> **transferred** - `Libraries/Renderer/implementations/ReactNativeRenderer-dev.js`: transfered -> **transferred** - `ReactAndroid/src/main/java/com/facebook/react/modules/network/ProgressiveStringDecoder.java`: remainderLenght -> **remainderLength** - `ReactAndroid/src/main/jni/first-party/yogajni/jni/ScopedGlobalRef.h`: Transfering -> **Transferring** - `ReactCommon/react/renderer/graphics/Transform.h`: tranformation -> **transformation** - `packages/rn-tester/js/examples/ToastAndroid/ToastAndroidExample.android.js`: occured -> **occurred** ## Changelog <!-- Help reviewers and the release process by writing your own changelog entry. For an example, see: https://github.com/facebook/react-native/wiki/Changelog --> [Internal] [Fixed] - fix typos Pull Request resolved: https://github.com/facebook/react-native/pull/33040 Test Plan: Considering this only changes code comments, I don’t think this pull request needs a test plan. Reviewed By: cortinico, pasqualeanatriello Differential Revision: D34003812 Pulled By: dmitryrykun fbshipit-source-id: 5c8699f8efcc4354854190a9aade30dbc5c90fdb
170 lines
3.6 KiB
JavaScript
170 lines
3.6 KiB
JavaScript
/**
|
|
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
*
|
|
* This source code is licensed under the MIT license found in the
|
|
* LICENSE file in the root directory of this source tree.
|
|
*
|
|
* @format
|
|
* @flow
|
|
*/
|
|
|
|
'use strict';
|
|
|
|
const React = require('react');
|
|
|
|
const {StyleSheet, Text, ToastAndroid, Pressable} = require('react-native');
|
|
|
|
const ToastWithShortDuration = () => {
|
|
return (
|
|
<Pressable
|
|
onPress={() =>
|
|
ToastAndroid.show('Copied to clipboard!', ToastAndroid.SHORT)
|
|
}>
|
|
<Text style={styles.text}>Tap to view toast</Text>
|
|
</Pressable>
|
|
);
|
|
};
|
|
|
|
const ToastWithLongDuration = () => {
|
|
return (
|
|
<Pressable
|
|
onPress={() => ToastAndroid.show('Sending message..', ToastAndroid.LONG)}>
|
|
<Text style={styles.text}>Tap to view toast</Text>
|
|
</Pressable>
|
|
);
|
|
};
|
|
|
|
const ToastWithTopGravity = () => {
|
|
return (
|
|
<Pressable
|
|
onPress={() =>
|
|
ToastAndroid.showWithGravity(
|
|
'Download Started..',
|
|
ToastAndroid.SHORT,
|
|
ToastAndroid.TOP,
|
|
)
|
|
}>
|
|
<Text style={styles.text}>Tap to view toast</Text>
|
|
</Pressable>
|
|
);
|
|
};
|
|
|
|
const ToastWithCenterGravity = () => {
|
|
return (
|
|
<Pressable
|
|
onPress={() =>
|
|
ToastAndroid.showWithGravity(
|
|
'A problem has been occurred while submitting your data.',
|
|
ToastAndroid.SHORT,
|
|
ToastAndroid.CENTER,
|
|
)
|
|
}>
|
|
<Text style={styles.text}>Tap to view toast</Text>
|
|
</Pressable>
|
|
);
|
|
};
|
|
|
|
const ToastWithBottomGravity = () => {
|
|
return (
|
|
<Pressable
|
|
onPress={() =>
|
|
ToastAndroid.showWithGravity(
|
|
'Please read the contents carefully.',
|
|
ToastAndroid.SHORT,
|
|
ToastAndroid.BOTTOM,
|
|
)
|
|
}>
|
|
<Text style={styles.text}>Tap to view toast</Text>
|
|
</Pressable>
|
|
);
|
|
};
|
|
|
|
const ToastWithXOffset = () => {
|
|
return (
|
|
<Pressable
|
|
onPress={() =>
|
|
ToastAndroid.showWithGravityAndOffset(
|
|
'Alex sent you a friend request',
|
|
ToastAndroid.SHORT,
|
|
ToastAndroid.TOP,
|
|
250,
|
|
0,
|
|
)
|
|
}>
|
|
<Text style={styles.text}>Tap to view toast</Text>
|
|
</Pressable>
|
|
);
|
|
};
|
|
|
|
const ToastWithYOffset = () => {
|
|
return (
|
|
<Pressable
|
|
onPress={() =>
|
|
ToastAndroid.showWithGravityAndOffset(
|
|
'There was a problem with your internet connection',
|
|
ToastAndroid.SHORT,
|
|
ToastAndroid.BOTTOM,
|
|
0,
|
|
100,
|
|
)
|
|
}>
|
|
<Text style={styles.text}>Tap to view toast</Text>
|
|
</Pressable>
|
|
);
|
|
};
|
|
|
|
const styles = StyleSheet.create({
|
|
text: {
|
|
color: 'black',
|
|
},
|
|
});
|
|
|
|
exports.title = 'Toast Example';
|
|
exports.category = 'Android';
|
|
exports.description =
|
|
'Example that demonstrates the use of an Android Toast to provide feedback.';
|
|
exports.examples = [
|
|
{
|
|
title: 'Toast with Short Duration',
|
|
render(): React.Node {
|
|
return <ToastWithShortDuration />;
|
|
},
|
|
},
|
|
{
|
|
title: 'Toast with Long Duration',
|
|
render(): React.Node {
|
|
return <ToastWithLongDuration />;
|
|
},
|
|
},
|
|
{
|
|
title: 'Toast with Top Gravity',
|
|
render(): React.Node {
|
|
return <ToastWithTopGravity />;
|
|
},
|
|
},
|
|
{
|
|
title: 'Toast with Center Gravity',
|
|
render(): React.Node {
|
|
return <ToastWithCenterGravity />;
|
|
},
|
|
},
|
|
{
|
|
title: 'Toast with Bottom Gravity',
|
|
render(): React.Node {
|
|
return <ToastWithBottomGravity />;
|
|
},
|
|
},
|
|
{
|
|
title: 'Toast with X Offset',
|
|
render(): React.Node {
|
|
return <ToastWithXOffset />;
|
|
},
|
|
},
|
|
{
|
|
title: 'Toast with Y Offset',
|
|
render(): React.Node {
|
|
return <ToastWithYOffset />;
|
|
},
|
|
},
|
|
];
|