Skip to content

Commit 60e8958

Browse files
committed
demo: vue app update
1 parent 8386631 commit 60e8958

15 files changed

+76
-60
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,3 +81,4 @@ hooks
8181
/tempAngular
8282
/.gradle
8383
/.settings
84+
.gradle

demo-vue/app.webpack.config.js

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,13 @@ module.exports = (env, params = {}) => {
5252
const tsconfig = 'tsconfig.json';
5353
const projectRoot = params.projectRoot || __dirname;
5454
const appResourcesFullPath = resolve(projectRoot, appResourcesPath);
55+
const webpack = require('@nativescript/webpack');
5556

57+
const coreModulesPackageName = '@akylas/nativescript';
58+
config.resolve.modules = [resolve(__dirname, `node_modules/${coreModulesPackageName}`), resolve(__dirname, 'node_modules')];
59+
// Object.assign(config.resolve.alias, {
60+
// '@nativescript/core': `${coreModulesPackageName}`
61+
// });
5662
if (!!development) {
5763
const srcFullPath = resolve(projectRoot, '..', 'src');
5864
Object.assign(config.resolve.alias, {
@@ -128,8 +134,12 @@ module.exports = (env, params = {}) => {
128134
'@nativescript-community/ui-material-snackbar/snackbar$': '#/snackbar/snackbar.' + platform,
129135
'./snackbar$': '#/snackbar/snackbar.' + platform
130136
});
131-
console.log(config.resolve.alias);
132137
}
138+
139+
Object.assign(config.plugins.find((p) => p.constructor.name === 'DefinePlugin').definitions, {
140+
__UI_USE_EXTERNAL_RENDERER__: true,
141+
__UI_USE_XML_PARSER__: false
142+
});
133143
const symbolsParser = require('scss-symbols-parser');
134144
const mdiSymbols = symbolsParser.parseSymbols(readFileSync(resolve(projectRoot, 'node_modules/@mdi/font/scss/_variables.scss')).toString());
135145
const mdiIcons = JSON.parse(`{${mdiSymbols.variables[mdiSymbols.variables.length - 1].value.replace(/" (F|0)(.*?)([,\n]|$)/g, '": "$1$2"$3')}}`);

demo-vue/app/App_Resources/Android/app.gradle

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,9 @@
11

22
android {
3+
compileSdkVersion 31
34
defaultConfig {
4-
generatedDensities = []
5-
multiDexEnabled true
6-
applicationId = "org.nativescript.demovuematerial"
7-
8-
//override supported platforms
9-
// ndk {
10-
// abiFilters.clear()
11-
// abiFilters "armeabi-v7a"
12-
// }
13-
5+
multiDexEnabled true
6+
targetSdkVersion 31
147
}
158
aaptOptions {
169
additionalParameters "--no-version-vectors"
Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,11 @@
1-
21
ext {
3-
2+
androidxVersion = "1.6.0"
3+
androidXAppCompat = "1.4.1"
4+
androidXAppCompatVersion = "1.4.1"
5+
androidXFragment = "1.4.1"
6+
androidXTransition = "1.4.1"
7+
androidXRecyclerViewVersion = "1.2.1"
8+
androidXMaterial = "1.4.0"
9+
androidXBrowser = "1.3.0"
10+
cartoMobileVersion = "4.4.2"
411
}

demo-vue/app/App_Resources/Android/src/main/AndroidManifest.xml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,7 @@
1010
android:largeScreens="true"
1111
android:xlargeScreens="true"/>
1212

13-
<uses-sdk
14-
android:minSdkVersion="17"
15-
android:targetSdkVersion="__APILEVEL__"/>
13+
<uses-sdk android:targetSdkVersion="__APILEVEL__"/>
1614

1715
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
1816
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
@@ -21,6 +19,7 @@
2119
<application
2220
android:name="com.tns.NativeScriptApplication"
2321
android:allowBackup="true"
22+
android:hardwareAccelerated="true"
2423
android:supportsRtl="true"
2524
android:icon="@drawable/icon"
2625
android:label="@string/app_name"
@@ -32,7 +31,8 @@
3231
android:configChanges="keyboard|keyboardHidden|orientation|screenSize|smallestScreenSize|screenLayout|locale|uiMode"
3332
android:theme="@style/LaunchScreenTheme"
3433
android:windowSoftInputMode="stateHidden|adjustPan"
35-
android:launchMode="singleTask">
34+
android:launchMode="singleTask"
35+
android:exported="true">
3636

3737
<meta-data android:name="SET_THEME_ON_LAUNCH" android:resource="@style/AppTheme" />
3838

@@ -41,6 +41,6 @@
4141
<category android:name="android.intent.category.LAUNCHER" />
4242
</intent-filter>
4343
</activity>
44-
<activity android:name="com.tns.ErrorReportActivity"/>
44+
<activity android:name="com.tns.ErrorReportActivity" android:exported="false"/>
4545
</application>
4646
</manifest>

demo-vue/app/examples/BottomNavigation.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323

2424
<!-- The number of MDTabContentItem components should corespond to the number of MDTabStripItem components -->
2525
<MDTabContentItem>
26-
<Frame>
26+
<Frame id="test">
2727
<Page>
2828
<GridLayout backgroundColor="red" @loaded="onLoaded('red')" @tap="navigateToTabsSample">
2929
<Label text="Home Page" class="h2 text-center"></Label>
@@ -66,7 +66,7 @@ export default Vue.extend({
6666
frameModule.Frame.topmost().goBack();
6767
},
6868
onLoaded(name) {
69-
console.log('onTabLoaded', name)
69+
console.log('BN onTabLoaded', name)
7070
},
7171
navigateToTabsSample() {
7272
this.$navigateTo(Tabs);

demo-vue/app/examples/BottomNavigationBar.vue

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,20 @@
33
<ActionBar :title="title">
44
<NavigationButton text="Back" android.systemIcon="ic_menu_back" @tap="onNavigationButtonTap" />
55
</ActionBar>
6-
<GridLayout rows="*, auto" backgroundColor="blue">
7-
<StackLayout class="page" backgroundColor="white" row="0">
8-
<GridLayout class="p-20" v-if="currentTab === 0">
6+
<GridLayout class="page" backgroundColor="white" rows="*, auto">
7+
<MDTabs row="0" :selectedIndex="currentTab" swipeEnabled="false">
8+
<MDTabContentItem>
9+
<GridLayout class="p-20" >
910
<Label class="h1 text-center" text="First tab" textWrap="true"></Label>
1011
<Button text="select sthird" @tap="selectThird" horizontalAlignment="center" verticalAlignment="bottom" />
1112
</GridLayout>
12-
<GridLayout class="p-20" v-if="currentTab === 2">
13+
</MDTabContentItem>
14+
<MDTabContentItem>
15+
<GridLayout class="p-20">
1316
<Label class="h1 text-center" text="Third tab" textWrap="true"></Label>
1417
</GridLayout>
15-
</StackLayout>
18+
</MDTabContentItem>
19+
</MDTabs>
1620
<MDBottomNavigationBar
1721
ref="bottomBar"
1822
row="1"

demo-vue/app/examples/Tabs.vue

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
<NavigationButton text="Back" android.systemIcon="ic_menu_back" @tap="onNavigationButtonTap" />
55
</ActionBar>
66

7-
<MDTabs ref="tabs" unloadOnTabChange="false">
7+
<MDTabs ref="tabs" :unloadOnTabChange="false">
88
<!-- The bottom tab UI is created via MDTabStrip (the containier) and MDTabStripItem (for each tab)-->
99
<MDTabStrip>
1010
<MDTabStripItem>
@@ -39,7 +39,7 @@
3939

4040
<script lang="ts">
4141
import * as frameModule from '@nativescript/core/ui/frame';
42-
import { TabContentItem, Tabs } from '@nativescript-community/ui-material-tabs';
42+
import { TabContentItem, Tabs } from '@nativescript-community/ui-material-tabs/';
4343
import { Color, EventData, GridLayout, Label, StackLayout } from '@nativescript/core';
4444
4545
import Vue from 'vue';
@@ -60,7 +60,7 @@ export default Vue.extend({
6060
},
6161
6262
onLoaded(name) {
63-
console.log('onTabLoaded', name)
63+
console.log('onTabLoaded2', name)
6464
},
6565
createContent(index: number) {
6666
const label = new Label();

demo-vue/app/main.ts

Lines changed: 15 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,28 @@
1-
// import {Trace} from '@nativescript/core';
2-
// Trace.addCategories(Trace.categories.concat(Trace.categories.Layout));
3-
// Trace.enable();
4-
5-
import Vue from 'nativescript-vue';
1+
import Theme from '@nativescript-community/css-theme';
62
import ActivityIndicatorPlugin from '@nativescript-community/ui-material-activityindicator/vue';
3+
import BottomNavigationPlugin from '@nativescript-community/ui-material-bottom-navigation/vue';
4+
import BottomNavigationBarPlugin from '@nativescript-community/ui-material-bottomnavigationbar/vue';
5+
import { install as installBottomSheet } from '@nativescript-community/ui-material-bottomsheet';
6+
import BottomSheetPlugin from '@nativescript-community/ui-material-bottomsheet/vue';
77
import ButtonPlugin from '@nativescript-community/ui-material-button/vue';
88
import CardViewPlugin from '@nativescript-community/ui-material-cardview/vue';
9+
import { installMixins, themer } from '@nativescript-community/ui-material-core';
910
import FloatingActionButtonPlugin from '@nativescript-community/ui-material-floatingactionbutton/vue';
1011
import ProgressPlugin from '@nativescript-community/ui-material-progress/vue';
1112
import RipplePlugin from '@nativescript-community/ui-material-ripple/vue';
1213
import SliderPlugin from '@nativescript-community/ui-material-slider/vue';
14+
import SpeedDialPlugin from '@nativescript-community/ui-material-speeddial/vue';
15+
import TabsPlugin from '@nativescript-community/ui-material-tabs/vue';
1316
import TextFieldPlugin from '@nativescript-community/ui-material-textfield/vue';
1417
import TextViewPlugin from '@nativescript-community/ui-material-textview/vue';
18+
import { Application, Trace } from '@nativescript/core';
1519
import { isIOS } from '@nativescript/core/platform';
16-
import { install as installBottomSheet } from '@nativescript-community/ui-material-bottomsheet';
17-
import BottomSheetPlugin from '@nativescript-community/ui-material-bottomsheet/vue';
18-
import BottomNavigationBarPlugin from '@nativescript-community/ui-material-bottomnavigationbar/vue';
19-
import TabsPlugin from '@nativescript-community/ui-material-tabs/vue';
20-
import BottomNavigationPlugin from '@nativescript-community/ui-material-bottom-navigation/vue';
21-
import SpeedDialPlugin from '@nativescript-community/ui-material-speeddial/vue';
22-
import Theme from '@nativescript-community/css-theme';
20+
import Vue from 'nativescript-vue';
21+
// import { getExamples } from './examples';
22+
import * as views from './views';
23+
Trace.addCategories(Trace.categories.Transition);
24+
Trace.addCategories(Trace.categories.Navigation);
25+
Trace.enable();
2326

2427
installBottomSheet();
2528

@@ -42,7 +45,6 @@ Vue.use(SpeedDialPlugin);
4245
Vue.registerElement('PreviousNextView', () => require('@nativescript/iqkeyboardmanager').PreviousNextView);
4346
Vue.registerElement('TextViewWithHint', () => require('@nativescript/iqkeyboardmanager').TextViewWithHint);
4447

45-
import { installMixins, themer } from '@nativescript-community/ui-material-core';
4648
installMixins();
4749
if (isIOS) {
4850
themer.setPrimaryColor('#bff937');
@@ -65,10 +67,6 @@ if (global.isAndroid) {
6567
});
6668
}
6769

68-
// import { getExamples } from './examples';
69-
import * as views from './views';
70-
import { Application } from '@nativescript/core';
71-
7270
// for (let item of getExamples()) {
7371
// Vue.component(item.component.name, item.component);
7472
// }

demo-vue/app/views/Home.ts

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,14 @@ export default {
3333
async goToExample(item) {
3434
console.log('goToExample', item.title);
3535
try {
36-
await this.$navigateTo(item.component);
36+
await this.$navigateTo(item.component, {
37+
// transition: {
38+
// name: 'slideTop',
39+
// duration: 1000
40+
// }
41+
});
3742
} catch (err) {
38-
console.error(err);
43+
console.error(err, err.stack);
3944
}
4045
},
4146
goToModalExample(item) {

0 commit comments

Comments
 (0)