mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
update website
This commit is contained in:
@@ -5,7 +5,8 @@ operates globally.</p><p>This JS code is a simple facade over the native iOS imp
|
||||
a clear JS API, real Error objects, and simple non-multi functions. Each
|
||||
method returns a <code>Promise</code> object.</p></div><span><h3><a class="anchor" name="methods"></a>Methods <a class="hash-link" href="#methods">#</a></h3><div class="props"><div class="prop"><h4 class="propTitle"><a class="anchor" name="getitem"></a><span class="propType">static </span>getItem<span class="propType">(key: string, callback?: ?(error: ?Error, result: ?string) => void)</span> <a class="hash-link" href="#getitem">#</a></h4><div><p>Fetches <code>key</code> and passes the result to <code>callback</code>, along with an <code>Error</code> if
|
||||
there is any. Returns a <code>Promise</code> object.</p></div></div><div class="prop"><h4 class="propTitle"><a class="anchor" name="setitem"></a><span class="propType">static </span>setItem<span class="propType">(key: string, value: string, callback?: ?(error: ?Error) => void)</span> <a class="hash-link" href="#setitem">#</a></h4><div><p>Sets <code>value</code> for <code>key</code> and calls <code>callback</code> on completion, along with an
|
||||
<code>Error</code> if there is any. Returns a <code>Promise</code> object.</p></div></div><div class="prop"><h4 class="propTitle"><a class="anchor" name="removeitem"></a><span class="propType">static </span>removeItem<span class="propType">(key: string, callback?: ?(error: ?Error) => void)</span> <a class="hash-link" href="#removeitem">#</a></h4><div><p>Returns a <code>Promise</code> object.</p></div></div><div class="prop"><h4 class="propTitle"><a class="anchor" name="mergeitem"></a><span class="propType">static </span>mergeItem<span class="propType">(key: string, value: string, callback?: ?(error: ?Error) => void)</span> <a class="hash-link" href="#mergeitem">#</a></h4><div><p>Merges existing value with input value, assuming they are stringified json. Returns a <code>Promise</code> object.</p><p>Not supported by all native implementations.</p></div></div><div class="prop"><h4 class="propTitle"><a class="anchor" name="clear"></a><span class="propType">static </span>clear<span class="propType">(callback?: ?(error: ?Error) => void)</span> <a class="hash-link" href="#clear">#</a></h4><div><p>Erases <em>all</em> AsyncStorage for all clients, libraries, etc. You probably
|
||||
<code>Error</code> if there is any. Returns a <code>Promise</code> object.</p></div></div><div class="prop"><h4 class="propTitle"><a class="anchor" name="removeitem"></a><span class="propType">static </span>removeItem<span class="propType">(key: string, callback?: ?(error: ?Error) => void)</span> <a class="hash-link" href="#removeitem">#</a></h4><div><p>Returns a <code>Promise</code> object.</p></div></div><div class="prop"><h4 class="propTitle"><a class="anchor" name="mergeitem"></a><span class="propType">static </span>mergeItem<span class="propType">(key: string, value: string, callback?: ?(error: ?Error) => void)</span> <a class="hash-link" href="#mergeitem">#</a></h4><div><p>Merges existing value with input value, assuming they are stringified json.
|
||||
Returns a <code>Promise</code> object. Not supported by all native implementations.</p></div></div><div class="prop"><h4 class="propTitle"><a class="anchor" name="clear"></a><span class="propType">static </span>clear<span class="propType">(callback?: ?(error: ?Error) => void)</span> <a class="hash-link" href="#clear">#</a></h4><div><p>Erases <em>all</em> AsyncStorage for all clients, libraries, etc. You probably
|
||||
don't want to call this - use removeItem or multiRemove to clear only your
|
||||
own keys instead. Returns a <code>Promise</code> object.</p></div></div><div class="prop"><h4 class="propTitle"><a class="anchor" name="getallkeys"></a><span class="propType">static </span>getAllKeys<span class="propType">(callback?: ?(error: ?Error, keys: ?Array<string>) => void)</span> <a class="hash-link" href="#getallkeys">#</a></h4><div><p>Gets <em>all</em> keys known to the app, for all callers, libraries, etc. Returns a <code>Promise</code> object.</p></div></div><div class="prop"><h4 class="propTitle"><a class="anchor" name="multiget"></a><span class="propType">static </span>multiGet<span class="propType">(keys: Array<string>, callback?: ?(errors: ?Array<Error>, result: ?Array<Array<string>>) => void)</span> <a class="hash-link" href="#multiget">#</a></h4><div><p>multiGet invokes callback with an array of key-value pair arrays that
|
||||
matches the input format of multiSet. Returns a <code>Promise</code> object.</p><p> multiGet(['k1', 'k2'], cb) -> cb([['k1', 'val1'], ['k2', 'val2']])</p></div></div><div class="prop"><h4 class="propTitle"><a class="anchor" name="multiset"></a><span class="propType">static </span>multiSet<span class="propType">(keyValuePairs: Array<Array<string>>, callback?: ?(errors: ?Array<Error>) => void)</span> <a class="hash-link" href="#multiset">#</a></h4><div><p>multiSet and multiMerge take arrays of key-value array pairs that match
|
||||
|
||||
@@ -11,6 +11,7 @@ Dialog
|
||||
Intent
|
||||
Media
|
||||
Pasteboard
|
||||
PushNotificationIOS
|
||||
Alert</div><h3><a class="anchor" name="some-props-are-only-supported-on-one-platform"></a>Some props are only supported on one platform <a class="hash-link" href="#some-props-are-only-supported-on-one-platform">#</a></h3><p>There are properties that work on one platform only, either because they can inherently only be supported on that platform or because they haven't been implemented on the other platforms yet. All of these are annotated with <code>@platform</code> in JS docs and have a small badge next to them on the website. See e.g. <a href="https://facebook.github.io/react-native/docs/image.html" target="_blank">Image</a>.</p><h3><a class="anchor" name="platform-parity"></a>Platform parity <a class="hash-link" href="#platform-parity">#</a></h3><p>There are known cases where the APIs could be made more consistent across iOS and Android:</p><ul><li><code><SwitchAndroid></code> and <code><SwitchIOS></code> are very similar and should be unified to a single <code><Switch></code> component.</li><li><code><AndroidViewPager></code> (to be open sourced soon) and <code><ScrollView pagingEnabled={true}></code> on iOS do a similar thing. We might want to unify them to <code><ViewPager></code>.</li><li><code>alert()</code> needs Android support (once the Dialogs module is open sourced)</li><li>It might be possible to bring <code>LinkingIOS</code> and <code>IntentAndroid</code> (to be open sourced) closer together.</li><li><code>ActivityIndicator</code> could render a native spinning indicator on both platforms (currently this is done using <code>ActivityIndicatorIOS</code> on iOS and <code>ProgressBarAndroid</code> on Android).</li><li><code>ProgressBar</code> could render a horizontal progress bar on both platforms (currently only supported on iOS via <code>ProgressViewIOS</code>).</li></ul><h3><a class="anchor" name="publishing-modules-on-android"></a>Publishing modules on Android <a class="hash-link" href="#publishing-modules-on-android">#</a></h3><p>There is currently no easy way of publishing custom native modules on Android. Smooth work flow for contributors is important and this will be looked at very closely after the initial Open Source release. Of course the aim will be to streamline and optimize the process between iOS and Android as much as possible.</p><h3><a class="anchor" name="overlay-view-with-opacity-of-0-cannot-be-clicked-through"></a>Overlay view with opacity of 0 cannot be clicked through <a class="hash-link" href="#overlay-view-with-opacity-of-0-cannot-be-clicked-through">#</a></h3><p>There is a noted difference in the handling of Views with an opacity of 0 between iOS and Android. While iOS will allow these views to be clicked through and the View below will receive the touch input, for Android the touch will be blocked. This can be demonstrated in this example where it will only be possible to click the touchable on iOS.</p><div class="prism language-javascript"><View style<span class="token operator">=</span><span class="token punctuation">{</span><span class="token punctuation">{</span>flex<span class="token punctuation">:</span> <span class="token number">1</span><span class="token punctuation">}</span><span class="token punctuation">}</span><span class="token operator">></span>
|
||||
<TouchableOpacity onPress<span class="token operator">=</span><span class="token punctuation">{</span><span class="token punctuation">(</span><span class="token punctuation">)</span> <span class="token operator">=</span><span class="token operator">></span> <span class="token function">alert<span class="token punctuation">(</span></span><span class="token string">'hi!'</span><span class="token punctuation">)</span><span class="token punctuation">}</span><span class="token operator">></span>
|
||||
<Text<span class="token operator">></span>HELLO<span class="token operator">!</span><<span class="token operator">/</span>Text<span class="token operator">></span>
|
||||
|
||||
Reference in New Issue
Block a user