![require(esm) Backported to Node.js 20, Paving the Way for ESM-Only Packages](https://cdn.sanity.io/images/cgdhsj6q/production/be8ab80c8efa5907bc341c6fefe9aa20d239d890-1600x1097.png?w=400&fit=max&auto=format)
Security News
require(esm) Backported to Node.js 20, Paving the Way for ESM-Only Packages
require(esm) backported to Node.js 20, easing the transition to ESM-only packages and reducing complexity for developers as Node 18 nears end-of-life.
@joyfill/components-react-native
Advanced tools
We recommend visiting our official react-native setup guide https://docs.joyfill.io/docs/react-native.
Note userAccessTokens & identifiers will need to be stored on your end (usually on a user and set of existing form field-based data) in order to interact with our API and UI Components effectively
$ npm install @joyfill/components-react-native@latest react-native-webview react-native-svg @react-native-community/datetimepicker --save
$ cd ios && pod install
$ yarn add @joyfill/components-react-native@latest react-native-webview react-native-svg @react-native-community/datetimepicker
$ cd ios && pod install
$ npx expo install @joyfill/components-react-native@latest react-native-webview react-native-svg @react-native-community/datetimepicker
For full examples please see https://docs.joyfill.io/docs/react-native.
Below is a usable example of our react-native document native embedded. This will show a readonly or fillable depending on the mode
form to your users. The document (form) shown is based on your documentId
.
Make sure to replace the userAccessToken
and documentId
. Note that documentId
is just for this example, you can call our List all documents endpoint and grab an ID from there.
import React, { useState, useEffect } from 'react';
import { Dimensions, View } from 'react-native';
import { joyfillRetrieve } from './api.js';
import { JoyDoc, getDefaultDocument } from '@joyfill/components-react-native';
const screenWidth = Dimensions.get('window').width;
const userAccessToken = '<REPLACE_ME>';
const documentId = '<REPLACE_ME>';
function Document() {
const [doc, setDoc] = useState(getDefaultDocument());
// retrieve the document from our api (you can also pass an initial documentId into JoyDoc)
useEffect(() => {
const response = await joyfillRetrieve(documentId, userAccessToken).then(doc => {
setDoc(response);
});
}, []);
return (
<View style={{flex: 1}}>
<JoyDoc
mode="fill"
doc={doc}
width={screenWidth}
onChange={(changelogs, doc) => {
console.log('onChange doc: ', doc);
setDoc(doc);
}}
onUploadAsync={async (params, fileUploads) => {
// to see a full utilization of upload see api.js -> examples
console.log('onUploadAsync: ', fileUploads);
}}
/>
</View>
);
}
export default Document;
mode: 'fill' | 'readonly'
fill
is the mode where you simply input the field data into the formreadonly
is the mode where everything in the form is set to read-only.doc: object
doc
or any of its internal pages
or fields
have changed in the JSON. Ensure you’re creating new object instances when updating the document, pages, or fields before passing the updated doc
JSON back to the SDK. This will ensure your changes are properly detected and reflected in the SDK.initialPageId: string
_id
property of a Page object. For instance, page._id
.doc
it will fallback to displaying the first page in the pages
array.view: 'mobile' | 'desktop'
navigation: object
{ pages: true }
pages
property to true (display) or false (hide). For instance, {pages: false}
hides the page navigation.views
property to true (display) or false (hide). For instance, {views: false}
hides the views (mobile and primary) navigation options.onChange: (changelogs: object_array, doc: object) => {}
changelogs: object_array
doc: object
onFocus: (params: object, e: object) => {}
params: object
e: object
blur: Function
onChange
event yet then the e.blur()
function will trigger both the change and blur events in the following order: 1) onChange
2) onBlur
.e.blur()
will close the modal.onBlur: (params: object) => {}
params: object
theme: object
{ fontFamily: { regular: "Ariel", bold: "Ariel-bold" }, button: { primary: { fontWeight: "bold", borderRadius: "10px", ... } }
primary
, secondary
, and danger
support the React Native Supported StylesfontFamily: object
fontFamily.regular: string
fontFamily.bold: string
button: object
button.primary: object
button.secondary: object
button.danger: object
getDefaultDocument
getDefaultTemplate
getDocumentFromTemplate: ( template: object )
duplicate: ( original: object, defaults: object )
duplicatePage: ( original: object, fileId: string, pageId: string )
{ doc: object, changelogs: array }
doc
fully updated Document or Template with the page addedchangelogs
array of changelogs for new duplicate page.applyLogic: ( items: object_array, fields: object_array, fieldLookupKey: string )
@joyfill/conditional-logic
library. View libraryonFocus(params: object, e: object)
is fired when the field is focused.onChange
is fired when the field value is modified.onBlur
is fired when the field is blurred.onFocus
is fired when the field is pressed and selection modal is displayed.onChange
is fired when the field value is modified.onBlur
is fired when the field is blurred and the selection modal is closed.onFocus
is fired when an option is selected or unselected for the first time on the field.onChange
is fired when an option is selected or unselected in the field.onFocus
is fired when “view” button is pressed and modal is displayed.onChange
is fired when the field value is modified.onBlur
is fired when modal is closed.onFocus
is fired when “view” button is pressed and modal is displayed.
onUploadAsync
request.onChange
is fired when the field images are uploaded or removed.onBlur
is fired when modal is closed.onFocus
is fired when open modal button is pressed and modal is displayed.onChange
is fired when the field value is modified.onBlur
is fired when the modal is closed.onFocus
is fired when “view” button is pressed and modal is displayed.onBlur
is fired when modal is closed.onFocus
is fired when the cell is focused.onChange
is fired when the cell value is modified.onBlur
is fired when the cell is blurredonFocus
is fired when the cell is pressed and selection modal is displayed.onChange
is fired when the field value is modified.onBlur
is fired when the cell is blurred and the selection modal is closed.onFocus
is fired cell is pressed and modal is displayed.onChange
is fired when the cell images are uploaded or removed.onBlur
is fired when modal is closed.IMPORTANT NOTE: JoyDoc SDK onFocus
, onChange
and onBlur
events are not always called in the same order. Two different fields can be triggering events at the same time. For instance, if you have Field A focused and then focus on Field B, the Field B onFocus event could be fired before the Field A onBlur event. Always check the event params object ids to match up the associated field events.
FAQs
Joyfill React Native Components
The npm package @joyfill/components-react-native receives a total of 61 weekly downloads. As such, @joyfill/components-react-native popularity was classified as not popular.
We found that @joyfill/components-react-native demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
require(esm) backported to Node.js 20, easing the transition to ESM-only packages and reducing complexity for developers as Node 18 nears end-of-life.
Security News
PyPI now supports iOS and Android wheels, making it easier for Python developers to distribute mobile packages.
Security News
Create React App is officially deprecated due to React 19 issues and lack of maintenance—developers should switch to Vite or other modern alternatives.