Skip to content

Commit

Permalink
Add Expo With Navigation
Browse files Browse the repository at this point in the history
  • Loading branch information
pulkitkkr committed May 16, 2021
1 parent 0ba7ab7 commit 9d8b56f
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 4 deletions.
4 changes: 3 additions & 1 deletion app/javascript/packs/expo-app-bundle.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
import ReactOnRails from 'react-on-rails'

import ExpoAppWithoutNavigation from '../bundles/expo-without-navigation/App'
import ExpoAppWithNavigation from '../bundles/expo-with-navigation/App'

// This is how react_on_rails can see the Expo Apps in the browser.
ReactOnRails.register({
ExpoAppWithoutNavigation
ExpoAppWithoutNavigation,
ExpoAppWithNavigation
})
4 changes: 3 additions & 1 deletion app/javascript/packs/server-bundle.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,11 @@ import ReactOnRails from 'react-on-rails'

import HelloWorld from '../bundles/HelloWorld/components/HelloWorldServer'
import ExpoAppWithoutNavigation from '../bundles/expo-without-navigation/App'
import ExpoAppWithNavigation from '../bundles/expo-with-navigation/App'

// This is how react_on_rails can see the HelloWorld in the browser.
ReactOnRails.register({
HelloWorld,
ExpoAppWithoutNavigation
ExpoAppWithoutNavigation,
// ExpoAppWithNavigation
})
2 changes: 1 addition & 1 deletion app/views/expo/index.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<a href="/expo/hello-world">Expo Hello World Without React Navigation</a>
</li>
<li>
<a href="expo/navigation/">Expo Hello World With React Navigation</a>
<a href="expo/navigation">Expo Hello World With React Navigation</a>
</li>
</ol>

3 changes: 3 additions & 0 deletions app/views/expo/navigation.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<h1>This is a Demo of Server rendered Expo React Navigation App with React on Rails</h1>

<%= react_component("ExpoAppWithNavigation", props: @expo_props, prerender: false) %>
2 changes: 1 addition & 1 deletion config/routes.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@
get 'hello_world', to: 'hello_world#index'
get 'expo', to: 'expo#index'
get 'expo/hello-world', to: 'expo#hello_world'
get "expo/navigation(/*all)" => "expo#react_navigation"
get "expo/navigation(/*all)" => "expo#navigation"
# For details on the DSL available within this file, see https://guides.rubyonrails.org/routing.html
end

0 comments on commit 9d8b56f

Please sign in to comment.