# 📚 View Props ### Navigation - [🏡 Native modules made easy with Expo](/gYH9xz-oR2ai0Yih8if50w) - [👶 First Steps](/ANE6NSUlTSimTIrN-gMsBw) - [⚙️ Native Module](/mAIt0ctDTvSL5xV4uE9nWQ) - [📈 Passing data to view](/_gWWp8uoQwGkqKcEyfk8Tg) - [👉 📚 View Props](/96IjlLNDRvydILdkbfaA5A) - [🔥 View Events](/PQWXYmxLRCebmLfx3Fh_gg) - [🏞️ View Functions](/DcjStCFdT6euzWqnJqCL6w) - [👷♂️ Classes and Shared Objects](/__42gVw8RqiIgfSbVseIvw) - [📊 Views and shared object](/IgHyIAHQQPCbeBD74Ri4BA) --- ### Task 1 To control whether touch gestures are enabled, export a prop called `touchEnabled`. :::spoiler :robot_face: Android :open_file_folder: File `android/src/main/java/expo/modules/workshopscharts/LinearChartModule.kt` ```kotlin Prop("touchEnabled") { view: LinearChartView, touchEnabled: Boolean? -> view.setTouchEnabled(touchEnabled ?: true) } ``` :open_file_folder: File `android/src/main/java/expo/modules/workshopscharts/LinearChartView.kt` ```kotlin fun setTouchEnabled(value: Boolean) { chartView.setTouchEnabled(value) } ``` ::: :::spoiler :apple: iOS :open_file_folder: File `ios/LinearChartModule.swift` ```swift Prop("touchEnabled") { (view: LinearChartView, touchEnabled: Bool?) in view.setTouchEnabled(touchEnabled ?? true) } ``` :open_file_folder: File `ios/LinearChartView.swift` ```swift func setTouchEnabled(_ value: Bool) { chartView.dragEnabled = value } ``` ::: <br /> 📝 Full changelog: [open GitHub Commit](https://github.com/software-mansion-labs/appjs-2023-workshop-expo-modules/commit/849a865191d4fce6315bab010fc64288a4305445) --- ### Task 2 Similar to the previous task export a prop called `legendEnabled` that controls if a legend is displayed. :::spoiler :robot_face: Android :open_file_folder: File `android/src/main/java/expo/modules/workshopscharts/LinearChartModule.kt` ```kotlin Prop("legendEnabled") { view: LinearChartView, legendEnabled: Boolean? -> view.setLegendEnabled(legendEnabled ?: true) } ``` :open_file_folder: File `android/src/main/java/expo/modules/workshopscharts/LinearChartView.kt` ```kotlin fun setLegendEnabled(value: Boolean) { chartView.legend.isEnabled = value } ``` ::: :::spoiler :apple: iOS :open_file_folder: File `ios/LinearChartModule.swift` ```swift Prop("legendEnabled") { (view: LinearChartView, legendEnabled: Bool?) in view.setLegendEnabled(legendEnabled ?? true) } ``` :open_file_folder: File `ios/LinearChartView.swift` ```swift func setLegendEnabled(_ value: Bool) { chartView.legend.enabled = value } ``` ::: <br /> 📝 Full changelog: [open GitHub Commit](https://github.com/software-mansion-labs/appjs-2023-workshop-expo-modules/commit/9288c4fa7783b3f4edf5ed820ea211d27c0f99a4) --- ### [🔥 View Events](/PQWXYmxLRCebmLfx3Fh_gg)
×
Sign in
Email
Password
Forgot password
or
By clicking below, you agree to our
terms of service
.
Sign in via Facebook
Sign in via Twitter
Sign in via GitHub
Sign in via Dropbox
Sign in with Wallet
Wallet (
)
Connect another wallet
New to HackMD?
Sign up