UIKit React Native v3
UIKit React Native
UIKit
React Native
Home
/
UIKit
/
React Native

Customization

In Sendbird UIKit for React Native, you can customize all the components that make up SendbirdUIKitContainer, key functions, and resources.


SendbirdUIKitContainer options

There are three options within SendbirdUIKitContainer: Platform service interfaces, Header component, and Error boundary. All of these options are customizable.

Platform service interfaces

Platform service interfaces allow you to use certain native APIs such as saving and attaching image and video files. If you wish to implement custom interfaces, you can use other native module libraries that aren't supported by Sendbird UIKit for React Native. To learn more about customizing native modules, go to the PlatformServiceProvider page.

HeaderComponent

The HeaderComponent is used to render the default header module component in a key function. If the component returns null, the header is not rendered.

import { HeaderStyleContextType } from '@sendbird/uikit-react-native-foundation';

const UseReactNavigationHeader: HeaderStyleContextType['HeaderComponent'] = ({
    title,
    right,
    left,
    onPressLeft,
    onPressRight,
}) => {
    const navigation = useNavigation();

    useEffect(() => {
        navigation.setOptions({
            headerShown: true,
            headerTitleAlign: 'center',
            headerBackVisible: false,
            headerTitle: () => (typeof title === 'string' ? <Text subtitle2>{title}</Text> : title),
            headerLeft: () => <Pressable onPress={onPressLeft}>{left}</Pressable>,
            headerRight: () => <Pressable onPress={onPressRight}>{right}</Pressable>,
        });
    }, [title, right, left, onPressLeft, onPressRight]);

    return null;
};

const App = () => {
    return (
        <SendbirdUIKitContainer
            styles={{
                HeaderComponent: UseReactNavigationHeader,
            }}
        />
    );
};

ErrorBoundary

Error boundaries are used to find errors that occur at a component level. When there's an error in UIKit, you can assign a custom component to show that an error occurred. Through ErrorBoundary, you can track various errors and prevent the client app from force quitting due to runtime errors.

const App = () => {
    return (
        <SendbirdUIKitContainer
            errorBoundary={{
                onError: ({ error }) => {
                    Analytics.logError(error);
                },
                ErrorInfoComponent: ({ error, errorInfo, reset }) => {
                    return (
                        <View>
                            <Text>{error.message}</Text>
                            <Button onPress={reset}>{'reset uikit'}</Button>
                        </View>
                    );
                },
            }}
        />
    );
};

Key functions

In every key function, there's a fragment and a module. Each fragment has a corresponding module that creates the view, and each module is made up of customizable module components.

Fragment

A key function is available through a fragment, which consists of a module, context, and hook, to create a single screen. By using the components and features provided by UIKit for React Native, you can customize and implement a custom fragment. To learn more about custom fragments, go to the customize a fragment page.

Module

A module is a set of React components that are used to render and display a screen. It's composed of various components that display the UI of the screen and a provider that sends data to the context in the key function. If you don't wish to use the default module, you can replace it with a custom module. To learn more about custom modules, go to the customize a module page.


Resources

There are five style-related resources that you can use and customize in UIKit for React Native.

String

To learn more about custom strings, go to the customize the StringSet page.

Icon

To learn more about custom icons, go to the customize the icons page.

Theme

A theme is made up of colors and typography in UIKit and is applied to the entire screen. To learn more about custom theme, go to the customize the theme page.

Color

To learn more about custom colors, go to the customize the colors page.

Typography

To learn more about custom fonts, go to the customize the typography page.