UI Components in the JSS React Native sample app

Version: 22.x

UI components in an application built with the Sitecore JavaScript Rendering SDK (JSS) for React Native are no different from any other React Native component, except that they are dynamically added inside a Placeholder component that provides them with the fields property.

RequestResponse
import React from 'react';
import { View } from 'react-native';
import { Text } from '@sitecore-jss/sitecore-jss-react-native';

const Welcome = ({ fields }) => (
  <View>
    <Text field={fields.title} />
  </View>
);

export default Welcome;

Although the Welcome component is written as a stateless functional component because there is no internal component state or need for lifecycle methods, you can also use the ES6 class syntax and extend from React.Component. JSS does not place any limitations on the usage of normal React Native conventions.

Handling Sitecore field types

JSS for React Native provides helper components for handling Sitecore field types. Helper components are special components that render Sitecore field values and allow field editing in advanced Sitecore editors.

JSS for React Native includes components for displaying field types such as text, images, dates, rich text, and more.

Tip

Consult the Styleguide page in a JSS React Native sample application for live examples of all the available components.

Do you have some feedback for us?

If you have suggestions for improving this article,