Skip to content

Custom Font in not working in iOs #261

@sajjad-yousaf

Description

@sajjad-yousaf

I'm trying to Apply a custom font for Android iOS and it's working perfectly in Android but not in iOS. I have font files in the Xcode project inside the Resources folder and also exist in the Copy Bundle Resources. Please correct me where I'm making a mistake or is it a library bug?

const fontUrl = Platform.select({
ios: 'Raleway-Regular.ttf',
android: 'file:///android_asset/fonts/Raleway-Regular.ttf',
});

export const fontCss = @font-face { font-family: 'Raleway-Regular'; src: url('${fontUrl}') format('truetype'); } body { font-family: 'Raleway-Regular', sans-serif; font-size: 14px; font-weight: 100 };

                   <AutoHeightWebView
                        style={{ width: Dimensions.get('window').width - 40, marginBottom: 5, alignSelf: 'center' }}
                        source={{ html: this.props.item.description }}
                        originWhitelist={["https://*", "http://*", "file://*", "sms://*", "tel://*", "telprompt://*"]}
                        customStyle={fontCss}
                        scrollEnabled={false}
                        javaScriptEnabled={true} />

Metadata

Metadata

Assignees

Labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions