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:
@@ -25,7 +25,7 @@ CalendarManager<span class="token punctuation">.</span><span class="token functi
|
||||
location<span class="token punctuation">:</span> <span class="token string">'4 Privet Drive, Surrey'</span><span class="token punctuation">,</span>
|
||||
time<span class="token punctuation">:</span> date<span class="token punctuation">.</span><span class="token function">toTime<span class="token punctuation">(</span></span><span class="token punctuation">)</span><span class="token punctuation">,</span>
|
||||
description<span class="token punctuation">:</span> <span class="token string">'...'</span>
|
||||
<span class="token punctuation">}</span><span class="token punctuation">)</span></div><blockquote><p><strong>NOTE</strong>: About array and map</p><p>React Native doesn't provide any guarantees about the types of values in these structures. Your native module might expect array of strings, but if JavaScript calls your method with an array that contains number and string you'll get <code>NSArray</code> with <code>NSNumber</code> and <code>NSString</code>. It's developer's responsibility to check array/map values types (see <a href="https://github.com/facebook/react-native/blob/master/React/Base/RCTConvert.h" target="_blank"><code>RCTConvert</code></a> for helper methods).</p></blockquote><h1><a class="anchor" name="callbacks"></a>Callbacks <a class="hash-link" href="#callbacks">#</a></h1><blockquote><p><strong>WARNING</strong></p><p>This section is even more experimental than others, we don't have a set of best practices around callbacks yet.</p></blockquote><p>Native module also supports a special kind of argument - callback. In most cases it is used to provide function call result to JavaScript.</p><div class="prism language-javascript"><span class="token operator">-</span> <span class="token punctuation">(</span>void<span class="token punctuation">)</span>findEvents<span class="token punctuation">:</span><span class="token punctuation">(</span>RCTResponseSenderBlock<span class="token punctuation">)</span>callback
|
||||
<span class="token punctuation">}</span><span class="token punctuation">)</span></div><blockquote><p><strong>NOTE</strong>: About array and map</p><p>React Native doesn't provide any guarantees about the types of values in these structures. Your native module might expect array of strings, but if JavaScript calls your method with an array that contains number and string you'll get <code>NSArray</code> with <code>NSNumber</code> and <code>NSString</code>. It's the developer's responsibility to check array/map values types (see <a href="https://github.com/facebook/react-native/blob/master/React/Base/RCTConvert.h" target="_blank"><code>RCTConvert</code></a> for helper methods).</p></blockquote><h1><a class="anchor" name="callbacks"></a>Callbacks <a class="hash-link" href="#callbacks">#</a></h1><blockquote><p><strong>WARNING</strong></p><p>This section is even more experimental than others, we don't have a set of best practices around callbacks yet.</p></blockquote><p>Native module also supports a special kind of argument - callback. In most cases it is used to provide function call result to JavaScript.</p><div class="prism language-javascript"><span class="token operator">-</span> <span class="token punctuation">(</span>void<span class="token punctuation">)</span>findEvents<span class="token punctuation">:</span><span class="token punctuation">(</span>RCTResponseSenderBlock<span class="token punctuation">)</span>callback
|
||||
<span class="token punctuation">{</span>
|
||||
<span class="token function">RCT_EXPORT<span class="token punctuation">(</span></span><span class="token punctuation">)</span><span class="token punctuation">;</span>
|
||||
NSArray <span class="token operator">*</span>events <span class="token operator">=</span> <span class="token punctuation">.</span><span class="token punctuation">.</span><span class="token punctuation">.</span>
|
||||
|
||||
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user